validator

package
v0.0.0-...-d3e6282 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EInvalidEmail   = "invalid_email"
	EUnallowedEmail = "unallowed_email"
)

Variables

This section is empty.

Functions

func ValidateEmail

func ValidateEmail(email string, config EmailValidationConfig) error

func ValidateRegex

func ValidateRegex(str string, regex string) error

func ValidateString

func ValidateString(str string, config StringValidationConfig) error

Types

type EmailValidationConfig

type EmailValidationConfig struct {
	WhiteListedDomains []string `json:"whiteListedDomains" mapstructure:"white_listed_domains"`
	BlockOtherDomains  bool     `json:"blockOtherDomains" mapstructure:"block_other_domains"`
}

type StringValidationConfig

type StringValidationConfig struct {
	MinLength           int    `json:"minLength" mapstructure:"min_length"`
	MaxLength           int    `json:"maxLength" mapstructure:"max_length"`
	MinDigits           int    `json:"minDigits" mapstructure:"min_digits"`
	MinUppers           int    `json:"minUppers" mapstructure:"min_uppers"`
	MinLowers           int    `json:"minLowers" mapstructure:"min_lowers"`
	MinSpecials         int    `json:"minSpecials" mapstructure:"min_specials"`
	WhitespaceAllowed   bool   `json:"whitespaceAllowed" mapstructure:"whitespace_allowed"`
	AllowedSpecialChars string `json:"allowedSpecialChars" mapstructure:"allowed_special_chars"`
}

Jump to

Keyboard shortcuts

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