validation

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotEmptyIsEmpty           = "Value is required and can't be empty"
	EmailAddressInvalidFormat = "The input is not a valid email address"
	URLInvalidFormat          = "The input is not a valid URL"
	StringLengthTooShort      = "The input is less than %d characters long"
	StringLengthTooLong       = "The input is more than %d characters long"
	EmailNotExistsExists      = "E-mail already registered"
	IdenticalStringsNotSame   = "The two given tokens do not match"
	NotInArray                = "The input was not found in the haystack"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	Callback func(value string) ([]string, error)
}

Callback validator.

func (*Callback) IsValidString

func (s *Callback) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type EmailAddress

type EmailAddress struct{}

EmailAddress validator.

func (*EmailAddress) IsValidString

func (s *EmailAddress) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type EmailNotExists

type EmailNotExists struct {
	DB *sql.DB
}

EmailNotExists validator.

func (*EmailNotExists) IsValidString

func (s *EmailNotExists) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type FilterInterface

type FilterInterface interface {
	FilterString(value string) string
}

type IdenticalStrings

type IdenticalStrings struct {
	Pattern string
}

IdenticalStrings validator.

func (*IdenticalStrings) IsValidString

func (s *IdenticalStrings) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type InArray added in v1.28.0

type InArray struct {
	Haystack []string
}

InArray validator.

func (*InArray) IsValidString added in v1.28.0

func (s *InArray) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type InputFilter

type InputFilter struct {
	Filters    []FilterInterface
	Validators []ValidatorInterface
}

func (*InputFilter) IsValidString

func (s *InputFilter) IsValidString(value string) (string, []string, error)

IsValidString IsValidString.

type NotEmpty

type NotEmpty struct{}

NotEmpty validator.

func (*NotEmpty) IsValidString

func (s *NotEmpty) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type Recaptcha

type Recaptcha struct {
	ClientIP string
}

Recaptcha validator.

func (*Recaptcha) IsValidString

func (s *Recaptcha) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type StringLength

type StringLength struct {
	Min int
	Max int
}

StringLength validator.

func (*StringLength) IsValidString

func (s *StringLength) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type StringSingleSpaces

type StringSingleSpaces struct{}

StringSingleSpaces filter.

func (*StringSingleSpaces) FilterString

func (s *StringSingleSpaces) FilterString(value string) string

FilterString filter.

type StringTrimFilter

type StringTrimFilter struct{}

StringTrimFilter filter.

func (*StringTrimFilter) FilterString

func (s *StringTrimFilter) FilterString(value string) string

FilterString filter.

type URL added in v1.28.0

type URL struct{}

URL validator.

func (*URL) IsValidString added in v1.28.0

func (s *URL) IsValidString(value string) ([]string, error)

IsValidString IsValidString.

type ValidatorInterface

type ValidatorInterface interface {
	IsValidString(value string) ([]string, error)
}

Jump to

Keyboard shortcuts

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