diff --git a/util/gvalid/gvalid_z_example_test.go b/util/gvalid/gvalid_z_example_test.go index 0c56c37f9..e438ce710 100644 --- a/util/gvalid/gvalid_z_example_test.go +++ b/util/gvalid/gvalid_z_example_test.go @@ -189,6 +189,16 @@ func ExampleValidator_Data() { // The Password2 value `gofra` is not a valid password format } +func ExampleValidator_Data_Value() { + err := g.Validator().Rules("min:18"). + Messages("未成年人不允许注册哟"). + Data(16).Run(gctx.New()) + fmt.Println(err.String()) + + // Output: + // 未成年人不允许注册哟 +} + func ExampleValidator_Data_Map1() { params := map[string]interface{}{ "passport": "", @@ -480,16 +490,6 @@ func ExampleValidator_RuleFuncMap() { // Value Length Error!; Pass is not Same! } -func ExampleValidator_Data_Value() { - err := g.Validator().Rules("min:18"). - Messages("未成年人不允许注册哟"). - Data(16).Run(gctx.New()) - fmt.Println(err.String()) - - // Output: - // 未成年人不允许注册哟 -} - func ExampleValidator_RegisterRule() { type User struct { Id int