OSDN Git Service

modify ci
[bytom/vapor.git] / vendor / gopkg.in / go-playground / validator.v9 / _examples / custom-validation / main.go
diff --git a/vendor/gopkg.in/go-playground/validator.v9/_examples/custom-validation/main.go b/vendor/gopkg.in/go-playground/validator.v9/_examples/custom-validation/main.go
deleted file mode 100644 (file)
index 89781b6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package main
-
-import (
-       "fmt"
-
-       "gopkg.in/go-playground/validator.v9"
-)
-
-// MyStruct ..
-type MyStruct struct {
-       String string `validate:"is-awesome"`
-}
-
-// use a single instance of Validate, it caches struct info
-var validate *validator.Validate
-
-func main() {
-
-       validate = validator.New()
-       validate.RegisterValidation("is-awesome", ValidateMyVal)
-
-       s := MyStruct{String: "awesome"}
-
-       err := validate.Struct(s)
-       if err != nil {
-               fmt.Printf("Err(s):\n%+v\n", err)
-       }
-
-       s.String = "not awesome"
-       err = validate.Struct(s)
-       if err != nil {
-               fmt.Printf("Err(s):\n%+v\n", err)
-       }
-}
-
-// ValidateMyVal implements validator.Func
-func ValidateMyVal(fl validator.FieldLevel) bool {
-       return fl.Field().String() == "awesome"
-}