validutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Validtool  *validator.Validate
	ValidTrans *ut.Translator
)

Functions

func CheckPassword

func CheckPassword(s string) bool

func CheckStrongPassword

func CheckStrongPassword(s string) bool

func IsCnMobile

func IsCnMobile(val interface{}) bool

验证中国大陆的手机号码

func IsCnPhone

func IsCnPhone(val interface{}) bool

验证中国大陆的电话号码。支持如下格式:

0578-12345678-1234
057812345678-1234

若存在分机号,则分机号的连接符不能省略。

func IsEmail

func IsEmail(val interface{}) bool

验证一个值是否匹配一个邮箱。

func IsIP

func IsIP(val interface{}) bool

验证一个值是否为IP,可验证IP4和IP6

func IsIP4

func IsIP4(val interface{}) bool

验证一个值是滞为IP4

func IsIP6

func IsIP6(val interface{}) bool

验证一个值是否为IP6

func IsURL

func IsURL(val interface{}) bool

验证一个值是否标准的URL格式。支持IP和域名等格式

func NewValidatorTrans

func NewValidatorTrans() (*validator.Validate, *ut.Translator, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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