validators

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChineseRegRuler string = "^[\u4e00-\u9fa5]+$"

中文正则表达式

View Source
var EmailRegRuler string = `^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$`

邮箱正则表达式

View Source
var EnglishRegRuler string = `^[a-zA-Z0-9_\-]+$`

中文正则表达式

View Source
var IDCardRegRuler string = `^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$`

身份证正则表达式

View Source
var MobileRegRuler string = `^1[3456789]{1}\d{9}$`

手机号正则表达式

View Source
var Validators = map[string]ValidatorFunc{}

Functions

func InitValidators

func InitValidators()

func Matched

func Matched(fl validator.FieldLevel, regRuler string) bool

func RegisterValidators

func RegisterValidators(v map[string]ValidatorFunc)

Types

type ValidatorFunc

type ValidatorFunc validator.Func

Jump to

Keyboard shortcuts

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