1
0
mirror of https://github.com/beego/bee.git synced 2024-06-01 09:13:27 +00:00

Update g_controllers.go

兼容query中的日期时间参数。如:query=xxTime.lt:2016-01-01T23:22:21+08:00
This commit is contained in:
qida 2016-05-28 22:21:54 +08:00
parent ddc5da6a38
commit 99fcadee06

View File

@ -245,7 +245,7 @@ func (c *{{controllerName}}Controller) GetAll() {
// query: k:v,k:v
if v := c.GetString("query"); v != "" {
for _, cond := range strings.Split(v, ",") {
kv := strings.Split(cond, ":")
kv := strings.SplitN(cond, ":",2)
if len(kv) != 2 {
c.Data["json"] = errors.New("Error: invalid query key/value pair")
c.ServeJSON()