mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-07-03 17:22:33 +00:00
Remove usesd ref interface from the stream loader
This commit is contained in:
@@ -30,7 +30,7 @@ func (d *Database) LoadStream(target interface{}, filters ...interface{}) (loade
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
loader = &StreamLoader{cur: cursor, ctx: ctx, ref: target, query: composed}
|
loader = &StreamLoader{cur: cursor, ctx: ctx, query: composed}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ type StreamLoader struct {
|
|||||||
cur *mongox.Cursor
|
cur *mongox.Cursor
|
||||||
query *query.Query
|
query *query.Query
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
ref interface{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeNextMsg decodes the next document to an interface or returns an error
|
// DecodeNextMsg decodes the next document to an interface or returns an error
|
||||||
@@ -80,7 +79,7 @@ func (l *StreamLoader) Cursor() (cursor *mongox.Cursor) {
|
|||||||
func (l *StreamLoader) Close() (err error) {
|
func (l *StreamLoader) Close() (err error) {
|
||||||
|
|
||||||
closerr := l.cur.Close(l.ctx)
|
closerr := l.cur.Close(l.ctx)
|
||||||
invokerr := l.query.OnClose().Invoke(l.ctx, l.ref)
|
invokerr := l.query.OnClose().Invoke(l.ctx, nil)
|
||||||
|
|
||||||
if closerr != nil {
|
if closerr != nil {
|
||||||
err = closerr
|
err = closerr
|
||||||
|
|||||||
Reference in New Issue
Block a user