1
0
mirror of https://github.com/beego/bee.git synced 2024-11-26 11:31:29 +00:00

isnull filter needs boolean value for the Filter function

This commit is contained in:
Ronnie A. Baez Sesto 2016-11-16 15:31:10 -04:00 committed by GitHub
parent f7d2e04e07
commit 87e2237f5b

View File

@ -1062,8 +1062,16 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
for k, v := range query { for k, v := range query {
// rewrite dot-notation to Object__Attribute // rewrite dot-notation to Object__Attribute
k = strings.Replace(k, ".", "__", -1) k = strings.Replace(k, ".", "__", -1)
if strings.Contains(k, "isnull") {
var v2 bool
if v == "true" || v == "1" {
v2 = true
}
qs = qs.Filter(k, v2)
} else {
qs = qs.Filter(k, v) qs = qs.Filter(k, v)
} }
}
// order by: // order by:
var sortFields []string var sortFields []string
if len(sortby) != 0 { if len(sortby) != 0 {