1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 02:30:18 +00:00

validation: support required option for some struct tag valids

This commit is contained in:
miraclesu
2017-07-03 16:14:29 +08:00
parent 82586c70e9
commit e72b02b7cc
4 changed files with 81 additions and 0 deletions

View File

@ -23,6 +23,16 @@ import (
"unicode/utf8"
)
// CanSkipFuncs will skip valid if RequiredFirst is true and the struct field's value is empty
var CanSkipFuncs = map[string]struct{}{
"Email": struct{}{},
"IP": struct{}{},
"Mobile": struct{}{},
"Tel": struct{}{},
"Phone": struct{}{},
"ZipCode": struct{}{},
}
// MessageTmpls store commond validate template
var MessageTmpls = map[string]string{
"Required": "Can not be empty",