validator

package
v1.0.1-0...-bd443ad Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//密码
	PatternPassword = "[[:alnum:]~!@#$%^&*()-=]{8,50}"
	//登录名
	PatternLoginName = "^[a-zA-Z]{1}[:alnum:]{0,49}"
	//手机号
	PatternPhoneNum = "^(\\+\\d{2}-)?(\\d{2,3}-)?([1][3,4,5,7,8][0-9]\\d{8})$"
	//id号  字母数字32位
	PatternId = "[:alnum:]{32}"
)

Functions

func IdStrValid

func IdStrValid(
	v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value,
	field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string,
) bool

func IsIdStr

func IsIdStr(id string) bool

func IsLoginName

func IsLoginName(name string) bool

func IsPassword

func IsPassword(pswd string) bool

func IsPhoneNum

func IsPhoneNum(num string) bool

func IsPhoneNum2

func IsPhoneNum2(phone string) bool

func LoginNameValid

func LoginNameValid(
	v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value,
	field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string,
) bool

func PasswordValid

func PasswordValid(
	v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value,
	field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string,
) bool

func PhoneNumValid

func PhoneNumValid(
	v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value,
	field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string,
) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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