Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Female gender female. Female = 0 // Male gender male. Male = 1 )
Variables ¶
View Source
var ErrUnexpected = errors.New("参数校验出错")
ErrUnexpected unexpected error.
Functions ¶
func Verify ¶
func Verify(obj interface{}) error
Verify checks the data validity of the exportable field of the structure according to the validate tag.
func VerifyVarWithValue ¶
VerifyVarWithValue checks the data validity of the field against another field according to the validate tag.
Types ¶
type BankCard ¶
type BankCard string
BankCard bank card validator.
func NewBankCard ¶
NewBankCard new a bank card validator.
type CorpAccount ¶
type CorpAccount string
CorpAccount corp account validator.
func NewCorpAccount ¶
func NewCorpAccount(corpaccount string) CorpAccount
NewCorpAccount new a corp account validator.
func (CorpAccount) IsValid ¶
func (ca CorpAccount) IsValid() bool
IsValid checks the corp account is valid.
type IdCard ¶
type IdCard string
IdCard id card validator.
func (IdCard) GetBirthday ¶
GetBirthday gets the birthday recorded on id card.
type Validator ¶ added in v2.0.3
type Validator struct { V *validator.Validate T ut.Translator }
Validator represents the validator structure.
func MustNewValidator ¶ added in v2.0.3
func MustNewValidator() *Validator
MustNewValidator must new a validator.
func NewValidator ¶ added in v2.0.3
NewValidator new a validator.
func (*Validator) TranslateAll ¶ added in v2.0.3
TranslateAll translates all validation errors.
Click to show internal directories.
Click to hide internal directories.