Documentation ¶
Index ¶
- Variables
- func Equal(value1 string, value2 string) bool
- func Matches(value string, rx *regexp.Regexp) bool
- func MaxChars(value string, n int) bool
- func MinChars(value string, n int) bool
- func NotBlank(value string) bool
- func PermittedValue[T comparable](value T, permittedValues ...T) bool
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var EmailRX = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
regex for emails recommended by W3C and Web Hypertext Application Technology Working Group
Functions ¶
func PermittedValue ¶
func PermittedValue[T comparable](value T, permittedValues ...T) bool
checks if form has a specific value
Types ¶
type Validator ¶
FielErrors are associated with a form field and NonFieldErrors are just general form errors
func (*Validator) AddFieldError ¶
adds a new field error if it does not already exist
func (*Validator) AddNonFieldError ¶
create a NonFieldError
func (*Validator) CheckField ¶
checks for a specific field error
Click to show internal directories.
Click to hide internal directories.