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 := reflect.New(qqt)
|
||||||
qqv.Elem().Set(reflect.MakeSlice(qqt, 0, 0))
|
qqv.Elem().Set(reflect.MakeSlice(qqt, 0, 0))
|
||||||
qq := &Query{
|
qq := &Query{
|
||||||
Model: *m,
|
Model: m,
|
||||||
Collection: m.getColl(),
|
Collection: m.getColl(),
|
||||||
doc: qqv.Interface(),
|
doc: qqv.Interface(),
|
||||||
Op: OP_FIND_ALL,
|
Op: OP_FIND_ALL,
|
||||||
@ -199,7 +199,7 @@ func (m *Model) FindOne(query interface{}, options ...*options.FindOneOptions) (
|
|||||||
rawDoc: raw,
|
rawDoc: raw,
|
||||||
doc: v.Elem().Interface(),
|
doc: v.Elem().Interface(),
|
||||||
Op: OP_FIND_ONE,
|
Op: OP_FIND_ONE,
|
||||||
Model: *m,
|
Model: m,
|
||||||
}
|
}
|
||||||
qq.rawDoc = raw
|
qq.rawDoc = raw
|
||||||
err = rip.Decode(qq.doc)
|
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
|
// the operation from which this query stems
|
||||||
Op string
|
Op string
|
||||||
// the model instance associated with this query
|
// the model instance associated with this query
|
||||||
Model Model
|
Model *Model
|
||||||
done bool
|
done bool
|
||||||
rawDoc any
|
rawDoc any
|
||||||
doc any
|
doc any
|
||||||
|
Loading…
Reference in New Issue
Block a user