Documentation
¶
Index ¶
- Variables
- func Build()
- func CheckErrors(errors error)
- func NotBlank(fl validator.FieldLevel) (res bool)
- func PasswordValid(fl validator.FieldLevel) bool
- func Sanitizer(fl validator.FieldLevel) (res bool)
- func UsernameValid(fl validator.FieldLevel) bool
- type Checker
- type FormErrorField
- type MyValidator
Constants ¶
This section is empty.
Variables ¶
View Source
var (
PasswordPattern = regexp.MustCompile(`^[a-zA-Z0-9_]{6,20}$`)
)
View Source
var (
UsernamePattern = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_]{5,19}$`)
)
Functions ¶
func CheckErrors ¶
func CheckErrors(errors error)
func NotBlank ¶
func NotBlank(fl validator.FieldLevel) (res bool)
func PasswordValid ¶
func PasswordValid(fl validator.FieldLevel) bool
func Sanitizer ¶
func Sanitizer(fl validator.FieldLevel) (res bool)
func UsernameValid ¶
func UsernameValid(fl validator.FieldLevel) bool
Types ¶
type FormErrorField ¶
type FormErrorField struct {
ErrorField string `json:"error_field"`
ErrorMsg string `json:"error_msg"`
}
FormErrorField indicates the current form error content. which field is error and error message.
type MyValidator ¶
MyValidator my validator
var GlobalValidator *MyValidator
func (*MyValidator) Check ¶
func (m *MyValidator) Check(value interface{}) (errFields []*FormErrorField, err error)
Check /
Click to show internal directories.
Click to hide internal directories.