Override cursor Next function with a wrapper

This commit is contained in:
Nikita Tokarchuk
2019-05-16 22:09:19 +02:00
parent f6f1f27ff0
commit 98efc3faaa
+11
View File
@@ -38,6 +38,17 @@ func (l *ManyLoader) GetNext() error {
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
func (l *ManyLoader) Close() error {