validate

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEmail

func CheckEmail(email string) (ok bool)

CheckEmail 判断邮箱地址是否合法

func CheckPRCID

func CheckPRCID(id string) (ok bool)

CheckPRCID 检查身份证号是否合法

func CheckPassword

func CheckPassword(pwd string, level int) (err error)

CheckPassword 检查密码强度是否合法 1:密码长度6-24位 2:密码长度6-24位,必须同时包含字母和数字 3:密码长度6-24位,必须同时包含大写字母,小写字母和数字 4:密码长度6-24位,必须同时包含大写字母,小写字母,数字和特殊字符[!@#~$%^&*()+|_]

func CheckPhone

func CheckPhone(phone string) (ok bool)

CheckPhone 判断手机号是否合法

func CheckStruct

func CheckStruct(objs ...interface{}) (err error)

CheckStruct 校验结构体

func CheckUSCI

func CheckUSCI(id string) (ok bool)

CheckUSCI 检查统一社会信用代码是否合法

Types

type Bool

type Bool struct{}

Bool 对 string 进行合法性

func (*Bool) Validate

func (s *Bool) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type Email

type Email struct{}

Email 对字段进行非空检查

func (*Email) Validate

func (s *Email) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type In

type In struct{}

In 对 int 和 string 进行枚举集合校验

func (*In) Validate

func (s *In) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type Length

type Length struct{}

Length 对 string 进行长度校验 举例 len=1:10

func (*Length) Validate

func (s *Length) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type Max

type Max struct{}

Max 对字段进行最大值校验

func (*Max) Validate

func (s *Max) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type Min

type Min struct{}

Min 对字段进行最小值校验

func (*Min) Validate

func (s *Min) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type MobilePhone

type MobilePhone struct{}

MobilePhone 对字段进行非空检查

func (*MobilePhone) Validate

func (s *MobilePhone) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

type Must

type Must struct{}

Must 对字段进行非空检查

func (*Must) Validate

func (s *Must) Validate(t reflect.StructField, v reflect.Value, params []string) (err error)

Validate 校验实现

Jump to

Keyboard shortcuts

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