validator

package
v0.0.0-...-41aba7b Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnImplement = errors.NewStackError("unimplement")

Functions

func ParseValidatorAst

func ParseValidatorAst(structName, filename string) ([]string, error)

ParseValidatorField parse ast file, then returns a slice

func RegisterValidation

func RegisterValidation(key string, fn valkitv8.Func) error

func SetValidatorVersion

func SetValidatorVersion(version string)

TODO add v9 support

Types

type Field

type Field struct {
	Tag   string
	Value interface{}
}

type OpFn

type OpFn func(*Field) error

func Contains

func Contains(param string) OpFn

func ContainsAny

func ContainsAny(param string) OpFn

func ContainsRune

func ContainsRune(param string) OpFn

func Eq

func Eq(param string) OpFn

func Excludes

func Excludes(param string) OpFn

func ExcludesAll

func ExcludesAll(param string) OpFn

func ExcludesRune

func ExcludesRune(param string) OpFn

func Gt

func Gt(param string) OpFn

func Gte

func Gte(param string) OpFn

func Hexadecimal

func Hexadecimal() OpFn

func Hexcolor

func Hexcolor() OpFn

func IRGBA

func IRGBA() OpFn

func IsASCII

func IsASCII() OpFn

func IsAlpha

func IsAlpha() OpFn

func IsAlphanum

func IsAlphanum() OpFn

func IsBase64

func IsBase64() OpFn

func IsCIDR

func IsCIDR() OpFn

func IsCIDRv4

func IsCIDRv4() OpFn

func IsCIDRv6

func IsCIDRv6() OpFn

func IsChinese

func IsChinese() OpFn

func IsDataURI

func IsDataURI() OpFn

func IsEmail

func IsEmail() OpFn

func IsEq

func IsEq(param string) OpFn

func IsHSL

func IsHSL() OpFn

func IsHSLA

func IsHSLA() OpFn

func IsIP

func IsIP() OpFn

func IsIP4AddrResolvable

func IsIP4AddrResolvable() OpFn

func IsIP6AddrResolvable

func IsIP6AddrResolvable() OpFn

func IsIPAddrResolvable

func IsIPAddrResolvable() OpFn

func IsIPv4

func IsIPv4() OpFn

func IsIPv6

func IsIPv6() OpFn

func IsISBN

func IsISBN() OpFn

func IsISBN10

func IsISBN10() OpFn

func IsISBN13

func IsISBN13() OpFn

func IsLatitude

func IsLatitude() OpFn

func IsLongitude

func IsLongitude() OpFn

func IsMAC

func IsMAC() OpFn

func IsMultiByteCharacter

func IsMultiByteCharacter() OpFn

func IsNickName

func IsNickName() OpFn

func IsNumber

func IsNumber() OpFn

func IsNumeric

func IsNumeric() OpFn

func IsPrintableASCII

func IsPrintableASCII() OpFn

func IsRGB

func IsRGB() OpFn

func IsSSN

func IsSSN() OpFn

func IsTCP4AddrResolvable

func IsTCP4AddrResolvable() OpFn

func IsTCP6AddrResolvable

func IsTCP6AddrResolvable() OpFn

func IsTCPAddrResolvable

func IsTCPAddrResolvable() OpFn

func IsTime

func IsTime() OpFn

UTC time

func IsUDP4AddrResolvable

func IsUDP4AddrResolvable() OpFn

func IsUDP6AddrResolvable

func IsUDP6AddrResolvable() OpFn

func IsUDPAddrResolvable

func IsUDPAddrResolvable() OpFn

func IsURI

func IsURI() OpFn

func IsURL

func IsURL() OpFn

func IsUUID

func IsUUID() OpFn

func IsUUID3

func IsUUID3() OpFn

func IsUUID4

func IsUUID4() OpFn

func IsUUID5

func IsUUID5() OpFn

func IsUnixAddrResolvable

func IsUnixAddrResolvable() OpFn

func Len

func Len(param string) OpFn

func Lt

func Lt(param string) OpFn

func Lte

func Lte(param string) OpFn

func Max

func Max(param string) OpFn

field.Value <= max(param)

func Min

func Min(param string) OpFn

min(param) <= field.Value

func Ne

func Ne(param string) OpFn

func TimeAfter

func TimeAfter(arg interface{}) OpFn

UTC time TimeAfter reports whether the field.time instant t is after arg.time.

func TimeBefore

func TimeBefore(arg interface{}) OpFn

UTC time

type Validator

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

func NewValidator

func NewValidator() *Validator

func (*Validator) Err

func (m *Validator) Err() error

func (*Validator) Ok

func (m *Validator) Ok() bool

func (*Validator) Validate

func (m *Validator) Validate(field *Field, opFn OpFn) *Validator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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