validator

package
v0.0.0-...-1369677 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Female 女性
	Female = 0
	// Male 男性
	Male = 1
)

Variables

View Source
var (
	// ErrUnexpected 校验意外错误
	ErrUnexpected = errors.New("参数校验出错")
)

Functions

func ParseErr

func ParseErr(err error) string

ParseErr 解析验证错误具体内容

func Verify

func Verify(obj interface{}) error

Verify 根据validate标签验证结构体的可导出字段的数据合法性

Types

type BankCard

type BankCard string

BankCard 发卡行识别码

func NewBankCard

func NewBankCard(bankcard string) BankCard

NewBankCard 新建发卡行识别码校验器

func (BankCard) IsValid

func (bc BankCard) IsValid() bool

IsValid 判断是否合法

type CorpAccount

type CorpAccount string

CorpAccount 企业对公账户

func NewCorpAccount

func NewCorpAccount(corpaccount string) CorpAccount

NewCorpAccount 新建企业对公账户校验器

func (CorpAccount) IsValid

func (ca CorpAccount) IsValid() bool

IsValid 判断是否合法

type IdCard

type IdCard string

IdCard 公民身份号码

func NewIdCard

func NewIdCard(idcard string) IdCard

NewIdCard 新建公民身份号码校验器

func (IdCard) GetBirthday

func (ic IdCard) GetBirthday() (time.Time, error)

GetBirthday 获取生日日期

func (IdCard) GetGender

func (ic IdCard) GetGender() (int, error)

GetGender 获取性别

func (IdCard) IsFemale

func (ic IdCard) IsFemale() (bool, error)

IsFemale 判断是否为女性

func (IdCard) IsMale

func (ic IdCard) IsMale() (bool, error)

IsMale 判断是否为男性

func (IdCard) IsValid

func (ic IdCard) IsValid() bool

IsValid 判断是否合法

type USCC

type USCC string

USCC Uniform Social Credit Code 统一社会信用代码

func NewUSCC

func NewUSCC(uscc string) USCC

NewUSCC 新建统一社会信用代码校验器

func (USCC) IsValid

func (uscc USCC) IsValid() bool

IsValid 判断是否合法

Jump to

Keyboard shortcuts

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