validator

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemEmptyLimit    = 0
	ItemNotEmptyLimit = 1
	ItemNoLimit       = 0
)

Variables

This section is empty.

Functions

func Params

func Params(c *gin.Context, v Validator) error

func ValidLength

func ValidLength(str, keyName string, minimum, maximum int) error

func ValidateEmail

func ValidateEmail(email string) bool

func ValidateMobile

func ValidateMobile(mobile string) bool

Types

type ValidateFunc

type ValidateFunc func() error

func ValidateIP

func ValidateIP(value string, keyName string) ValidateFunc

func ValidateIntRange

func ValidateIntRange(value int, keyName string, minimum, maximum int) ValidateFunc

func ValidateRegexp

func ValidateRegexp(re *regexp.Regexp, str, keyName string) ValidateFunc

func ValidateSameString

func ValidateSameString(str1, keyName1, str2, keyName2 string) ValidateFunc

func ValidateString

func ValidateString(str, keyName string, minimum, maximum int) ValidateFunc

func ValidateStringArrayOptions

func ValidateStringArrayOptions(strList []string, keyName string, options []string) ValidateFunc

func ValidateStringOptions

func ValidateStringOptions(str string, keyName string, options []string) ValidateFunc

func ValidateStringPointer

func ValidateStringPointer(str *string, keyName string, minimum, maximum int) ValidateFunc

type ValidateWrapper

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

func NewWrapper

func NewWrapper(fns ...ValidateFunc) *ValidateWrapper

func (*ValidateWrapper) AddValidateFunc

func (vw *ValidateWrapper) AddValidateFunc(functions ...ValidateFunc)

func (*ValidateWrapper) Validate

func (vw *ValidateWrapper) Validate() error

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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