Documentation
¶
Overview ¶
Package validator 符合 web.filter 的验证器
Index ¶
- func Alpha(s string) bool
- func And[T any](v ...func(T) bool) func(T) bool
- func Ascii(s string) bool
- func BankCard(val string) bool
- func Between[T Number](min, max T) func(T) bool
- func BetweenEqual[T Number](min, max T) func(T) bool
- func CNMobile(val string) bool
- func CNPhone(val string) bool
- func CNTel(val string) bool
- func Email(val string) bool
- func EmptyOr(v func(string) bool) func(string) bool
- func EndWith(suffix string) func(string) bool
- func Equal[T comparable](v T) func(T) bool
- func GB11643(val string) bool
- func GB32100(val string) bool
- func Great[T Number](num T) func(T) bool
- func GreatEqual[T Number](num T) func(T) bool
- func HTTPStatus(s int) bool
- func HexColor(val string) bool
- func IP(val string) bool
- func IP4(val string) bool
- func IP6(val string) bool
- func ISBN(val string) bool
- func ISBN10(val string) bool
- func ISBN13(val string) bool
- func In[T comparable](element ...T) func(T) bool
- func Less[T Number](num T) func(T) bool
- func LessEqual[T Number](num T) func(T) bool
- func Luhn(val string) bool
- func Match(exp *regexp.Regexp) func(string) bool
- func NilOr[T any](v func(T) bool) func(T) bool
- func Not[T any](v func(T) bool) func(T) bool
- func NotIn[T comparable](element ...T) func(T) bool
- func Or[T any](v ...func(T) bool) func(T) bool
- func StartWith(prefix string) func(string) bool
- func Strength(length, upper, lower, punct int) func(string) bool
- func URL(val string) bool
- func Zero[T any](v T) bool
- func ZeroOr[T Number](v func(T) bool) func(T) bool
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BetweenEqual ¶
BetweenEqual 判断数值区间 [min, max]
func CNPhone ¶
CNPhone 验证中国大陆的电话号码
支持如下格式:
0578-12345678-1234 057812345678-1234
若存在分机号,则分机号的连接符不能省略。
func GB11643 ¶
GB11643 判断一个身份证是否符合 gb11643 标准
若是 15 位则当作一代身份证,仅简单地判断各位是否都是数字; 若是 18 位则当作二代身份证,会计算校验位是否正确;
func GreatEqual ¶
func In ¶
func In[T comparable](element ...T) func(T) bool
In 声明枚举类型的验证规则
要求验证的值必须包含在 element 元素中,如果不存在,则返回 msg 的内容。
Types ¶
Click to show internal directories.
Click to hide internal directories.