valid

package
v0.0.0-...-0e7c249 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotEqual = errors.New("values are not equal")
	ErrNotNil   = errors.New("value is not nil")
	ErrNil      = errors.New("value is nil")
)
View Source
var (
	ErrInvalidTextPattern = errors.New("invalid text pattern")
	ErrTextTooLong        = errors.New("text is too long")
	ErrTextTooShort       = errors.New("text is too short")
	ErrTextMissingUpper   = errors.New("missing uppercase character")
	ErrTextMissingLower   = errors.New("missing lowercase character")
	ErrTextMissingSpecial = errors.New("missing special character")
	ErrTextMissingNumber  = errors.New("missing number")

	ErrInvalidEmail    = errors.New("invalid email")
	ErrTextInvalidSlug = errors.New("invalid slug")
)
View Source
var (
	ErrIncompatibleTypes = errors.New("incompatible types")
)
View Source
var (
	ErrNumberOutOfRange = errors.New("number is out of range")
)

Functions

This section is empty.

Types

type Constraint

type Constraint func(value interface{}) error

func Email

func Email() Constraint

func Equal

func Equal(value interface{}) Constraint

func HasLowerCase

func HasLowerCase() Constraint

func HasNumber

func HasNumber() Constraint

func HasSpecial

func HasSpecial() Constraint

func HasUpperCase

func HasUpperCase() Constraint

func MaxLength

func MaxLength(n int) Constraint

func MinLength

func MinLength(n int) Constraint

func MinMaxLength

func MinMaxLength(min, max int) Constraint

func Nil

func Nil() Constraint

func NotNil

func NotNil() Constraint

func Range

func Range(min interface{}, max interface{}) Constraint

func Regexp

func Regexp(s string) Constraint

func Slug

func Slug() Constraint

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func New

func New(constraints ...Constraint) *Validator

func (Validator) Validate

func (v Validator) Validate(value interface{}) error

Jump to

Keyboard shortcuts

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