xvalidator

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// 正则
	UserNameRegexp = `^[a-zA-Z][a-zA-Z0-9_-]{3,15}$`
	PasswordRegexp = `^[a-fA-F0-9]{32,64}$`
	EmailRegexp    = `^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$`
	//PhoneRegexp    = `^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$`
	MobileRegexp = `^(1)\d{10}$`
	PhoneRegexp  = "" /* 156-byte string literal not displayed */
)

Variables

View Source
var (
	Validator *validator.Validate
)

Functions

func XValidParseToString added in v1.1.0

func XValidParseToString(fl validator.FieldLevel) (string, error)

解析为字符串

func XValid_Register_Regex added in v1.0.9

func XValid_Register_Regex(fl validator.FieldLevel, verificationStr string) (bool, string)

正则验证器匹配验证

func XValid_Register_Regex_Reverse added in v1.0.9

func XValid_Register_Regex_Reverse(fl validator.FieldLevel, verificationStr string) (bool, string)

正则验证器不匹配验证

func XValidator

func XValidator(u interface{}, showFirstError bool) (error, *[]xresponse.ParamError)

* 通过xvalid_error注入需要自定义显示的错误信息

func XValidatorInit

func XValidatorInit() error

Types

This section is empty.

Jump to

Keyboard shortcuts

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