fix bug where result.Document.self != result

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-04-10 16:06:55 -04:00
parent 510a126f4b
commit f56df39be8
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -611,10 +611,18 @@ func (q *Query) Exec(result interface{}) {
imodel, ok := cur.Interface().(IDocument) imodel, ok := cur.Interface().(IDocument)
if ok { if ok {
imodel.setExists(true) imodel.setExists(true)
imodel.SetSelf(imodel)
doc.Elem().Index(i).Set(reflect.ValueOf(imodel)) doc.Elem().Index(i).Set(reflect.ValueOf(imodel))
} }
} }
} }
if idoc, ok := q.doc.(IDocument); ok {
idoc.SetSelf(result)
}
if rdoc, ok2 := result.(IDocument); ok2 {
rdoc.SetSelf(result)
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(q.doc).Elem()) reflect.ValueOf(result).Elem().Set(reflect.ValueOf(q.doc).Elem())
q.done = true q.done = true
} }