Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Required = Rule{ Name: "required", Message: "is required", Validate: func(v interface{}) bool { if v == nil { return false } if s, ok := v.(string); ok { return strings.TrimSpace(s) != "" } return true }, } Email = Rule{ Name: "email", Message: "must be a valid email address", Validate: func(v interface{}) bool { s, ok := v.(string) if !ok { return false } pattern := `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` matched, _ := regexp.MatchString(pattern, s) return matched }, } )
Common validation rules.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.