validator

package
v0.0.0-...-19bee3a Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindTranslator

func FindTranslator(locales ...string) (trans ut.Translator)

func RegisterTranslation

func RegisterTranslation(tag string, registerFn validator.RegisterTranslationsFunc, translationFn validator.TranslationFunc, locales ...string) error

func RegisterValidation

func RegisterValidation(tag string, fn validator.Func, callValidationEvenIfNull ...bool) error

func Struct

func Struct(i interface{}) error

func ValidateChinaMobilePhoneNum

func ValidateChinaMobilePhoneNum(fl validator.FieldLevel) bool

func ValidateDBType

func ValidateDBType(field reflect.Value) (val interface{})

ValidateDBType 验证数据库类型

func ValidateIdCard

func ValidateIdCard(fl validator.FieldLevel) bool

func ValidateUniq

func ValidateUniq(fl validator.FieldLevel) bool

Types

type TsValidator

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

func New

func New() *TsValidator

New 创建新的验证器

func Validate

func Validate() *TsValidator

func (*TsValidator) Engine

func (v *TsValidator) Engine() interface{}

func (*TsValidator) RegisterTranslation

func (v *TsValidator) RegisterTranslation(tag string, registerFn validator.RegisterTranslationsFunc, translationFn validator.TranslationFunc, locales ...string) error

func (*TsValidator) RegisterValidation

func (v *TsValidator) RegisterValidation(tag string, fn validator.Func, callValidationEvenIfNull ...bool) error

func (*TsValidator) Struct

func (v *TsValidator) Struct(obj interface{}) error

func (*TsValidator) Validate

func (v *TsValidator) Validate(i interface{}) error

Validate For echo

func (*TsValidator) Var

func (v *TsValidator) Var(field interface{}, tag string) error

func (*TsValidator) VarWithValue

func (v *TsValidator) VarWithValue(field interface{}, other interface{}, tag string) error

Jump to

Keyboard shortcuts

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