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 IsCommonPassword(value string) bool
- func IsEmail[T ~string](value T) 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
- func Validate[T any](data T, validators ...ValidatorFunc[T]) error
- type Validator
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPasswordIsRequired = errors.New("password is required") ErrPasswordIsCommon = errors.New("password is common") )
View Source
var CommonPasswords = []string{}/* 10000 elements not displayed */
CommonPasswords list is from https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10k-most-common.txt
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 IsCommonPassword ¶ added in v0.3.1
func NoDuplicates ¶
func NoDuplicates[T comparable](values []T) bool
func NotIn ¶
func NotIn[T comparable](value T, blocklist ...T) bool
func Validate ¶
func Validate[T any](data T, validators ...ValidatorFunc[T]) error
Types ¶
type ValidatorFunc ¶ added in v0.3.1
Click to show internal directories.
Click to hide internal directories.