package
0.0.0-20230101183712-202847b4b89b
Repository: https://github.com/corestoreio/pkg.git
Documentation: pkg.go.dev
# Functions
Abs returns absolute value of number.
ByteLength check string's length.
HasLowerCase check if the string contains at least 1 lowercase.
HasUpperCase check if the string contians as least 1 uppercase.
InRangeFloat64 returns true if value lies between left and right border.
InRangeInt64 returns true if value lies between left and right border.
InRangeUint64 returns true if value lies between left and right border.
IsAlpha check if the string contains only letters (a-zA-Z).
IsAlphanumeric check if the string contains only letters and numbers.
IsASCII check if the string contains ASCII chars only.
IsBase64 check if a string is base64 encoded.
IsBool check if the string is a bool.
IsByteLength check if the string's length (in bytes) falls in a range.
IsCIDR check if the string is an valid CIDR notiation (IPV4 & IPV6).
IsCreditCard check if the string is a credit card.
IsDataURI checks if a string is base64 encoded data URI such as an image.
IsDialString validates the given string for usage with the various Dial() functions.
IsDivisibleBy check if the string is a number that's divisible by another.
IsDNSName will validate the given string as a DNS name.
IsEmailRegexp runs a complex regex check if the string is an email.
IsEmailSimple checks if the str contains one @.
IsExistingEmail check if the string is an email of existing domain.
IsFilePath check is a string is Win or Unix file path and returns it's type.
IsFloat check if the string is a float.
IsFullWidth check if the string contains any full-width chars.
IsHalfWidth check if the string contains any half-width chars.
IsHash checks if a string is a hash of type algorithm.
IsHexadecimal check if the string is a hexadecimal number.
IsHexcolor check if the string is a hexadecimal color.
IsHost checks if the string is a valid IP (both v4 and v6) or a valid DNS name.
IsIn check if string str is a member of the set of strings params.
IsInt check if the string is an integer.
IsIP checks if a string is either IP version 4 or 6.
IsIPv4 check if the string is an IP version 4.
IsIPv6 check if the string is an IP version 6.
IsISBN check if the string is an ISBN (version 10 or 13).
IsISBN10 check if the string is an ISBN version 10.
IsISBN13 check if the string is an ISBN version 13.
IsISO3166Alpha2 checks if a string is valid two-letter country code.
IsISO3166Alpha3 checks if a string is valid three-letter country code.
IsISO4217 check if string is valid ISO currency code.
IsISO693Alpha2 checks if a string is valid two-letter language code.
IsISO693Alpha3b checks if a string is valid three-letter language code.
IsLatitude check if a string is valid latitude.
IsLocale checks case-insensitive if the provided string is a locale.
IsLongitude check if a string is valid longitude.
IsLowerCase check if the string is lowercase.
IsMAC check if a string is valid MAC address.
IsMongoID check if the string is a valid hex-encoded representation of a MongoDB ObjectId.
IsMultibyte check if the string contains one or more multibyte chars.
IsNatural returns true if value is natural number (positive and whole).
IsNegative returns true if value < 0.
IsNonNegative returns true if value >= 0.
IsNonPositive returns true if value <= 0.
IsNotEmpty check if the string is not empty.
IsNotEmptyTrimSpace check if the white space trimmed string is not empty.
IsNull check if the string is null.
IsNumeric check if the string contains only numbers.
IsPort checks if a string represents a valid port.
IsPositive returns true if value > 0.
IsPrintableASCII check if the string contains printable ASCII chars only.
IsRequestURI check if the string rawurl, assuming it was received in an HTTP request, is an absolute URI or an absolute path.
IsRequestURL check if the string rawurl, assuming it was received in an HTTP request, is a valid URL confirm to RFC 3986.
IsRFC3339 check if string is valid timestamp value according to RFC3339.
IsRFC3339WithoutZone check if string is valid timestamp value according to RFC3339 which excludes the timezone.
IsRGBcolor check if the string is a valid RGB color in form rgb(RRR, GGG, BBB).
IsRsaPublicKey check if a string is valid public key with provided length.
IsSemver check if string is valid semantic version.
IsSSN will validate the given string as a U.S.
IsTime check if string is valid according to given format.
IsUpperCase check if the string is uppercase.
IsURL check if the string is an URL.
IsUTFDigit check if the string contains only unicode radix-10 decimal digits.
IsUTFLetter check if the string contains only unicode letter characters.
IsUTFLetterNumeric check if the string contains only unicode letters and numbers.
IsUTFNumeric check if the string contains only unicode numbers of any kind.
IsUUID check if the string is a UUID (version 3, 4 or 5).
IsUUIDv3 check if the string is a UUID version 3.
IsUUIDv4 check if the string is a UUID version 4.
IsUUIDv5 check if the string is a UUID version 5.
IsVariableWidth check if the string contains a mixture of full and half-width chars.
IsWhole returns true if value is whole number.
Matches check if string matches the pattern (pattern is regular expression) In case of error return false.
Sign returns signum of number: 1 in case of value > 0, -1 in case of value < 0, 0 otherwise.
StringLength check string's length (including multi byte strings).
# Constants
No description provided by the author
Unix is *nix OS types.
Unknown is unresolved OS type.
Win is Windows type.
# Variables
ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes".
ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json.
LocaleList contains all locales and their English names.
# Structs
ISO3166Entry stores country codes.
ISO693Entry stores ISO language codes.
LocaleEntry defines an ISO locale code like: de_DE or en_US or zh-Hans-SG [Chinese (Simplified, Singapore)].
# Interfaces
Validator general interface that a type has implemented for validation.