change Query.Model to a pointer
This commit is contained in:
parent
4297071b3b
commit
cd20d2c9eb
4
model.go
4
model.go
@ -135,7 +135,7 @@ func (m *Model) Find(query interface{}, opts ...*options.FindOptions) (*Query, e
|
||||
qqv := reflect.New(qqt)
|
||||
qqv.Elem().Set(reflect.MakeSlice(qqt, 0, 0))
|
||||
qq := &Query{
|
||||
Model: *m,
|
||||
Model: m,
|
||||
Collection: m.getColl(),
|
||||
doc: qqv.Interface(),
|
||||
Op: OP_FIND_ALL,
|
||||
@ -199,7 +199,7 @@ func (m *Model) FindOne(query interface{}, options ...*options.FindOneOptions) (
|
||||
rawDoc: raw,
|
||||
doc: v.Elem().Interface(),
|
||||
Op: OP_FIND_ONE,
|
||||
Model: *m,
|
||||
Model: m,
|
||||
}
|
||||
qq.rawDoc = raw
|
||||
err = rip.Decode(qq.doc)
|
||||
|
2
query.go
2
query.go
@ -20,7 +20,7 @@ type Query struct {
|
||||
// the operation from which this query stems
|
||||
Op string
|
||||
// the model instance associated with this query
|
||||
Model Model
|
||||
Model *Model
|
||||
done bool
|
||||
rawDoc any
|
||||
doc any
|
||||
|
Loading…
Reference in New Issue
Block a user