mirror of
https://github.com/astaxie/beego.git
synced 2025-07-03 17:40:18 +00:00
support reverse m2m relation
This commit is contained in:
@ -119,8 +119,11 @@ func (o *orm) QueryM2M(md interface{}, name string) QueryM2Mer {
|
||||
mi, ind := o.getMiInd(md)
|
||||
fi := o.getFieldInfo(mi, name)
|
||||
|
||||
if fi.fieldType != RelManyToMany {
|
||||
panic(fmt.Errorf("<Ormer.QueryM2M> name `%s` for model `%s` is not a m2m field", fi.name, mi.fullName))
|
||||
switch {
|
||||
case fi.fieldType == RelManyToMany:
|
||||
case fi.fieldType == RelReverseMany && fi.reverseFieldInfo.mi.isThrough:
|
||||
default:
|
||||
panic(fmt.Errorf("<Ormer.QueryM2M> model `%s` . name `%s` is not a m2m field", fi.name, mi.fullName))
|
||||
}
|
||||
|
||||
return newQueryM2M(md, o, mi, fi, ind)
|
||||
|
Reference in New Issue
Block a user