From 5b42060ea8fedd4d1d7700aecdf0905ee5039710 Mon Sep 17 00:00:00 2001 From: john Date: Mon, 6 Aug 2018 09:58:19 +0800 Subject: [PATCH] gvalid.CheckObject -> gvalid.CheckStruct --- g/util/gvalid/gvalid.go | 2 +- g/util/gvalid/gvalid_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/g/util/gvalid/gvalid.go b/g/util/gvalid/gvalid.go index a3dbfe2bd..3b88682ea 100644 --- a/g/util/gvalid/gvalid.go +++ b/g/util/gvalid/gvalid.go @@ -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...) } diff --git a/g/util/gvalid/gvalid_test.go b/g/util/gvalid/gvalid_test.go index d6206cda2..fd96f0206 100644 --- a/g/util/gvalid/gvalid_test.go +++ b/g/util/gvalid/gvalid_test.go @@ -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校验失败") } }