mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 02:30:53 +00:00
remove QueryRelated and QueryRelatedCtx
This commit is contained in:
parent
2e7fb81348
commit
21f281655d
@ -305,6 +305,7 @@ func (o *ormBase) QueryM2MWithCtx(ctx context.Context, md interface{}, name stri
|
|||||||
func (o *ormBase) LoadRelated(md interface{}, name string, args ...interface{}) (int64, error) {
|
func (o *ormBase) LoadRelated(md interface{}, name string, args ...interface{}) (int64, error) {
|
||||||
return o.LoadRelatedWithCtx(context.Background(), md, name, args...)
|
return o.LoadRelatedWithCtx(context.Background(), md, name, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ormBase) LoadRelatedWithCtx(ctx context.Context, md interface{}, name string, args ...interface{}) (int64, error) {
|
func (o *ormBase) LoadRelatedWithCtx(ctx context.Context, md interface{}, name string, args ...interface{}) (int64, error) {
|
||||||
_, fi, ind, qseter := o.queryRelated(md, name)
|
_, fi, ind, qseter := o.queryRelated(md, name)
|
||||||
|
|
||||||
@ -366,21 +367,6 @@ func (o *ormBase) LoadRelatedWithCtx(ctx context.Context, md interface{}, name s
|
|||||||
return nums, err
|
return nums, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a QuerySeter for related models to md model.
|
|
||||||
// it can do all, update, delete in QuerySeter.
|
|
||||||
// example:
|
|
||||||
// qs := orm.QueryRelated(post,"Tag")
|
|
||||||
// qs.All(&[]*Tag{})
|
|
||||||
//
|
|
||||||
func (o *ormBase) QueryRelated(md interface{}, name string) QuerySeter {
|
|
||||||
return o.QueryRelatedWithCtx(context.Background(), md, name)
|
|
||||||
}
|
|
||||||
func (o *ormBase) QueryRelatedWithCtx(ctx context.Context, md interface{}, name string) QuerySeter {
|
|
||||||
// is this api needed ?
|
|
||||||
_, _, _, qs := o.queryRelated(md, name)
|
|
||||||
return qs
|
|
||||||
}
|
|
||||||
|
|
||||||
// get QuerySeter for related models to md model
|
// get QuerySeter for related models to md model
|
||||||
func (o *ormBase) queryRelated(md interface{}, name string) (*modelInfo, *fieldInfo, reflect.Value, QuerySeter) {
|
func (o *ormBase) queryRelated(md interface{}, name string) (*modelInfo, *fieldInfo, reflect.Value, QuerySeter) {
|
||||||
mi, ind := o.getMiInd(md, true)
|
mi, ind := o.getMiInd(md, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user