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

Merge pull request #321 from r0nni3/r0nni3-patch-isnull-filter

isnull filter needs boolean value for the Filter function
This commit is contained in:
Faissal Elamraoui 2016-11-20 22:42:54 +01:00 committed by GitHub
commit ac935ad4e0

View File

@ -1038,8 +1038,12 @@ 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") {
qs = qs.Filter(k, (v == "true" || v == "1"))
} 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 {