mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 12:17:53 +08:00
gvalid.CheckObject -> gvalid.CheckStruct
This commit is contained in:
parent
656e9c35d6
commit
5b42060ea8
@ -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...)
|
||||
}
|
||||
|
||||
|
@ -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校验失败")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user