Documentation ¶
Index ¶
- Variables
- func AllIn[T comparable](values []T, safelist ...T) bool
- func Between[T constraints.Ordered](value, min, max T) bool
- func In[T comparable](value T, safelist ...T) bool
- func IsEmail(value string) bool
- func IsURL(value string) bool
- func Matches(value string, rx *regexp.Regexp) bool
- func MaxRunes(value string, n int) bool
- func MinRunes(value string, n int) bool
- func NoDuplicates[T comparable](values []T) bool
- func NotBlank(value string) bool
- func NotIn[T comparable](value T, blocklist ...T) bool
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var (
RgxEmail = 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])?)*$")
)
Functions ¶
func AllIn ¶
func AllIn[T comparable](values []T, safelist ...T) bool
func Between ¶
func Between[T constraints.Ordered](value, min, max T) bool
func In ¶
func In[T comparable](value T, safelist ...T) bool
func NoDuplicates ¶
func NoDuplicates[T comparable](values []T) bool
func NotIn ¶
func NotIn[T comparable](value T, blocklist ...T) bool
Types ¶
type Validator ¶
type Validator struct { Errors []string `json:",omitempty"` FieldErrors map[string]string `json:",omitempty"` }
func (*Validator) AddFieldError ¶
func (*Validator) CheckField ¶
Click to show internal directories.
Click to hide internal directories.