1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 17:00:50 +00:00

remove QueryRelated and QueryRelatedCtx

This commit is contained in:
Ming Deng 2020-07-27 21:22:40 +08:00
parent 2e7fb81348
commit 21f281655d

View File

@ -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) {
return o.LoadRelatedWithCtx(context.Background(), md, name, args...)
}
func (o *ormBase) LoadRelatedWithCtx(ctx context.Context, md interface{}, name string, args ...interface{}) (int64, error) {
_, 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 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
func (o *ormBase) queryRelated(md interface{}, name string) (*modelInfo, *fieldInfo, reflect.Value, QuerySeter) {
mi, ind := o.getMiInd(md, true)