Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DisallowUpper is a validator that disallows uppercase characters. DisallowUpper = &CustomValidator{ Key: "disallow_upper", Func: func(fl validator.FieldLevel) bool { for _, r := range fl.Field().String() { if unicode.IsUpper(r) { return false } } return true }, } // DisallowSpace is a validator that disallows spaces. DisallowSpace = &CustomValidator{ Key: "disallow_space", Func: func(fl validator.FieldLevel) bool { for _, r := range fl.Field().String() { if unicode.IsSpace(r) { return false } } return true }, } )
Functions ¶
Types ¶
type CustomValidator ¶
type CustomValidator struct { Key string Func validator.Func }
Click to show internal directories.
Click to hide internal directories.