1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 05:00:54 +00:00

allow dot notation in query field

This commit is contained in:
ZhengYang 2014-08-05 15:27:05 +08:00
parent 337bd38b73
commit 06f2e2cca9

View File

@ -632,6 +632,8 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
qs := o.QueryTable(new({{modelName}})) qs := o.QueryTable(new({{modelName}}))
// query k=v // query k=v
for k, v := range query { for k, v := range query {
// rewrite dot-notation to Object__Attribute
k = strings.Replace(k, ".", "__", -1)
qs = qs.Filter(k, v) qs = qs.Filter(k, v)
} }
// order by: // order by: