Override cursor Next function with a wrapper

v2
Nikita Tokarchuk 6 years ago
parent f6f1f27ff0
commit 98efc3faaa
  1. 11
      mongox/common/loadmany.go

@ -38,6 +38,17 @@ func (l *ManyLoader) GetNext() error {
return nil return nil
} }
// Next loads next documents but doesn't perform decoding
func (l *ManyLoader) Next() error {
hasNext := l.Cursor.Next(l.ctx)
if !hasNext {
return errors.NotFoundErrorf("%s", mongo.ErrNoDocuments)
}
return nil
}
// Close cursor // Close cursor
func (l *ManyLoader) Close() error { func (l *ManyLoader) Close() error {

Loading…
Cancel
Save