validation

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: MIT Imports: 7 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"
	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"
)

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 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 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