validator

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 IsEmail

func IsEmail[T ~string](value T) bool

func IsURL

func IsURL(value string) bool

func Matches

func Matches(value string, rx *regexp.Regexp) bool

func MaxRunes

func MaxRunes(value string, n int) bool

func MinRunes

func MinRunes(value string, n int) bool

func NoDuplicates

func NoDuplicates[T comparable](values []T) bool

func NotBlank

func NotBlank(value string) bool

func NotIn

func NotIn[T comparable](value T, blocklist ...T) bool

func Validate

func Validate[T any](data T, validators ...Validator[T]) error

Types

type Validator

type Validator[T any] func(T) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL