gvalid.CheckObject -> gvalid.CheckStruct

This commit is contained in:
john 2018-08-06 09:58:19 +08:00
parent 656e9c35d6
commit 5b42060ea8
2 changed files with 2 additions and 2 deletions

View File

@ -421,7 +421,7 @@ func CheckMap(params map[string]interface{}, rules map[string]string, msgs...map
}
// 校验struct对象属性object参数也可以是一个指向对象的指针返回值同CheckMap方法
func CheckObject(object interface{}, rules map[string]string, msgs...map[string]interface{}) map[string]map[string]string {
func CheckStruct(object interface{}, rules map[string]string, msgs...map[string]interface{}) map[string]map[string]string {
return CheckMap(structs.Map(object), rules, msgs...)
}

View File

@ -82,7 +82,7 @@ func Test_CheckObject(t *testing.T) {
"Age" : "年龄为18到30周岁",
}
obj := &Object{"john", 16}
if m := gvalid.CheckObject(obj, rules, msgs); m == nil {
if m := gvalid.CheckStruct(obj, rules, msgs); m == nil {
t.Error("CheckObject校验失败")
}
}