Update validator.v8 升级为 validator.v9

This commit is contained in:
新亮
2019-08-29 19:32:48 +08:00
parent f71349c33e
commit 4036ab2b23
50 changed files with 10222 additions and 29 deletions
+1 -14
View File
@@ -1,18 +1,5 @@
package param_bind
import (
"github.com/gin-gonic/gin/binding"
"go-gin-api/app/controller/param_verify"
"gopkg.in/go-playground/validator.v8"
)
type ProductAdd struct {
Name string `form:"name" json:"name" binding:"required,NameValid"`
}
func init() {
// 绑定验证器
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
v.RegisterValidation("NameValid", param_verify.NameValid)
}
Name string `form:"name" json:"name" validate:"required,NameValid"`
}