Update g_model.go

This commit is contained in:
Shimon 2019-07-11 18:00:18 +08:00 committed by GitHub
parent d511719703
commit e86aad1be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -224,11 +224,11 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
} }
} }
m := make(map[string]interface{}) result := make(map[string]interface{})
if i, ex := qs.Count(); ex != nil { if i, ex := qs.Count(); ex != nil {
return nil, errors.New("Error: get total record failed") return nil, errors.New("Error: get total record failed")
} else { } else {
m["TotalRecord"] = i result["TotalRecord"] = i
} }
var l []{{modelName}} var l []{{modelName}}
@ -250,8 +250,8 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
list = append(list, m) list = append(list, m)
} }
} }
m["List"] = list result["List"] = list
return m, nil return result, nil
}else { }else {
return nil, err return nil, err
} }