Documentation ¶
Overview ¶
Package govalidator is package of validators and sanitizers for strings, structs and collections.
Index ¶
- Constants
- func IsBase64(str string) bool
- func IsCreditCard(str string) bool
- func IsHexcolor(str string) bool
- func IsIPv6(str string) bool
- func IsISBN(str string, version int) bool
- func IsISBN10(str string) bool
- func IsISBN13(str string) bool
- func IsInt(str string) bool
- func IsMAC(str string) bool
- func IsNull(str string) bool
- func IsRGBcolor(str string) bool
- func IsRequestURI(rawurl string) bool
- func IsSSN(str string) bool
- func ToInt(value interface{}) (res int64, err error)
Constants ¶
const ( CreditCard string = "" /* 151-byte string literal not displayed */ ISBN10 string = "^(?:[0-9]{9}X|[0-9]{10})$" ISBN13 string = "^(?:[0-9]{13})$" Hexcolor string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$" RGBcolor string = "" /* 157-byte string literal not displayed */ Base64 string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$" SSN string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$` Int string = "^(?:[-+]?(?:0|[1-9][0-9]*))$" )
Basic regular expressions for validating strings
Variables ¶
This section is empty.
Functions ¶
func IsCreditCard ¶
IsCreditCard check if the string is a credit card.
func IsHexcolor ¶
IsHexcolor check if the string is a hexadecimal color.
func IsISBN ¶
IsISBN check if the string is an ISBN (version 10 or 13). If version value is not equal to 10 or 13, it will be check both variants.
func IsMAC ¶
IsMAC check if a string is valid MAC address. Possible MAC formats: 01:23:45:67:89:ab 01:23:45:67:89:ab:cd:ef 01-23-45-67-89-ab 01-23-45-67-89-ab-cd-ef 0123.4567.89ab 0123.4567.89ab.cdef
func IsRGBcolor ¶
IsRGBcolor check if the string is a valid RGB color in form rgb(RRR, GGG, BBB).
func IsRequestURI ¶
IsRequestURI check if the string rawurl, assuming it was received in an HTTP request, is an absolute URI or an absolute path.
Types ¶
This section is empty.