Remove usesd ref interface from the stream loader

v2
Nikita Tokarchuk 3 years ago
parent 80a5c864c5
commit 04382db4cd
No known key found for this signature in database
GPG Key ID: C4378F005530EDF2
  1. 2
      mongox/database/loadstream.go
  2. 3
      mongox/database/streamloader.go

@ -30,7 +30,7 @@ func (d *Database) LoadStream(target interface{}, filters ...interface{}) (loade
return
}
loader = &StreamLoader{cur: cursor, ctx: ctx, ref: target, query: composed}
loader = &StreamLoader{cur: cursor, ctx: ctx, query: composed}
return
}

@ -13,7 +13,6 @@ type StreamLoader struct {
cur *mongox.Cursor
query *query.Query
ctx context.Context
ref interface{}
}
// 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) {
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 {
err = closerr

Loading…
Cancel
Save