Documentation ¶
Index ¶
- Constants
- Variables
- func ASCII(s string) bool
- func Alpha(s string) bool
- func Alphanumeric(s string) bool
- func Base64(s string) bool
- func ByteLength(str string, min, max int) bool
- func CreditCard(str string) bool
- func DNSName(str string) bool
- func DataURI(str string) bool
- func DialString(str string) bool
- func Email(s string) bool
- func Exists(path string) (bool, error)
- func FilePath(str string) (bool, int)
- func Float(str string) bool
- func FullWidth(str string) bool
- func HalfWidth(str string) bool
- func Hexadecimal(str string) bool
- func Hexcolor(str string) bool
- func IP(str string) bool
- func IPv4(str string) bool
- func IPv6(str string) bool
- func ISBN(str string, version int) bool
- func ISBN10(str string) bool
- func ISBN13(str string) bool
- func ISO3166Alpha2(str string) bool
- func ISO3166Alpha3(str string) bool
- func InRange(value, left, right float64) bool
- func Int(str string) bool
- func JSON(str string) bool
- func Latitude(str string) bool
- func Longitude(str string) bool
- func LowerCase(str string) bool
- func MAC(str string) bool
- func MongoID(str string) bool
- func Multibyte(s string) bool
- func Natural(value float64) bool
- func Numeric(s string) bool
- func Port(str string) bool
- func PrintableASCII(s string) bool
- func RGBcolor(str string) bool
- func RequestURI(rawurl string) bool
- func RequestURL(rawurl string) bool
- func SSN(str string) bool
- func Semver(str string) bool
- func StringLength(str string, min int, max int) bool
- func URL(str string) bool
- func UTFDigit(s string) bool
- func UTFLetter(str string) bool
- func UTFLetterNumeric(s string) bool
- func UTFNumeric(s string) bool
- func UUID(str string) bool
- func UUIDv3(str string) bool
- func UUIDv4(str string) bool
- func UUIDv5(str string) bool
- func UpperCase(str string) bool
- func VariableWidth(str string) bool
- func Whole(value float64) bool
- type ISO3166Entry
Constants ¶
const ( // Unknown is unresolved OS type Unknown = iota // Win is Windows type Win // Unix is *nix OS types Unix )
Used by IsFilePath func
Variables ¶
var ISO3166List = []ISO3166Entry{}/* 249 elements not displayed */
ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes"
Functions ¶
func Alphanumeric ¶
Alphanumeric check if the string contains only letters and numbers. Empty string is valid.
func ByteLength ¶
ByteLength check if the string's length (in bytes) falls in a range.
func DialString ¶
DialString validates the given string for usage with the various Dial() functions
func Email ¶
Email is a constraint to do a simple validation for email addresses, it only check if the string contains "@" and that it is not in the first or last character of the string https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses
func FullWidth ¶
FullWidth check if the string contains any full-width chars. Empty string is valid.
func HalfWidth ¶
HalfWidth check if the string contains any half-width chars. Empty string is valid.
func Hexadecimal ¶
Hexadecimal check if the string is a hexadecimal number.
func ISBN ¶
ISBN 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 ISO3166Alpha2 ¶
ISO3166Alpha2 checks if a string is valid two-letter country code
func ISO3166Alpha3 ¶
ISO3166Alpha3 checks if a string is valid three-letter country code
func MAC ¶
MAC 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 MongoID ¶
MongoID check if the string is a valid hex-encoded representation of a MongoDB ObjectId.
func Multibyte ¶
Multibyte check if the string contains one or more multibyte chars. Empty string is valid.
func PrintableASCII ¶
PrintableASCII check if the string contains printable ASCII chars only. Empty string is valid.
func RequestURI ¶
RequestURI check if the string rawurl, assuming it was received in an HTTP request, is an absolute URI or an absolute path.
func RequestURL ¶
RequestURL check if the string rawurl, assuming it was received in an HTTP request, is a valid URL confirm to RFC 3986
func StringLength ¶
StringLength check string's length (including multi byte strings)
func UTFDigit ¶
UTFDigit check if the string contains only unicode radix-10 decimal digits. Empty string is valid.
func UTFLetter ¶
UTFLetter check if the string contains only unicode letter characters. Similar to IsAlpha but for all languages. Empty string is valid.
func UTFLetterNumeric ¶
UTFLetterNumeric check if the string contains only unicode letters and numbers. Empty string is valid.
func UTFNumeric ¶
UTFNumeric check if the string contains only unicode numbers of any kind. Numbers can be 0-9 but also Fractions ¾,Roman Ⅸ and Hangzhou 〩. Empty string is valid.
func VariableWidth ¶
VariableWidth check if the string contains a mixture of full and half-width chars. Empty string is valid.