Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/asaskevich/govalidator
/ functions
Functions
388 in github.com/asaskevich/govalidator
⨍
Functions
388
◇
Types & classes
58
↓ 32 callers
Function
ValidateStruct
ValidateStruct use tags for fields. result will be equal to `false` if there are any errors. todo currently there is no guarantee that errors will be
validator.go:1107
↓ 20 callers
Function
IsNull
IsNull checks if the string is null.
validator.go:320
↓ 18 callers
Function
IsHash
IsHash checks if a string is a hash of type algorithm. Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd16
validator.go:685
↓ 12 callers
Function
ToInt
ToInt convert the input string or any int type to an integer type 64, or 0 if the input is not an integer.
converter.go:50
↓ 10 callers
Method
Error
()
error.go:36
↓ 7 callers
Function
randomArray
(n int)
arrays_benchmark_test.go:14
↓ 6 callers
Function
SetFieldsRequiredByDefault
SetFieldsRequiredByDefault causes validation to fail when struct fields do not include validations or are not explicitly marked as exempt (using `vali
validator.go:51
↓ 6 callers
Function
ToFloat
ToFloat convert the input string to a float, or 0.0 if the input is not a float.
converter.go:26
↓ 4 callers
Function
InRange
InRange returns true if value lies between left and right border, generic type to handle int, float32, float64 and string. All types must the same typ
numerics.go:73
↓ 4 callers
Function
InRangeFloat64
InRangeFloat64 returns true if value lies between left and right border
numerics.go:63
↓ 4 callers
Function
InRangeInt
InRangeInt returns true if value lies between left and right border
numerics.go:44
↓ 4 callers
Function
IsIP
IsIP checks if a string is either IP version 4 or 6. Alias for `net.ParseIP`
validator.go:807
↓ 4 callers
Function
IsPositive
IsPositive returns true if value > 0
numerics.go:29
↓ 4 callers
Function
IsWhole
IsWhole returns true if value is whole number
numerics.go:93
↓ 4 callers
Function
Matches
Matches checks if string matches the pattern (pattern is regular expression) In case of error return false
utils.go:22
↓ 4 callers
Function
ReplacePattern
ReplacePattern replaces regular expression pattern in string
utils.go:80
↓ 4 callers
Method
Set
(name string, ctv CustomTypeValidator)
types.go:101
↓ 3 callers
Function
Abs
Abs returns absolute value of number
numerics.go:8
↓ 3 callers
Function
Contains
Contains checks if the string contains the substring.
utils.go:16
↓ 3 callers
Function
Count
Count iterates over the slice and apply ConditionIterator to every item. Returns count of items that meets ConditionIterator.
arrays.go:79
↓ 3 callers
Function
Each
Each iterates over the slice and apply Iterator to every item
arrays.go:42
↓ 3 callers
Method
Errors
Errors returns itself.
error.go:12
↓ 3 callers
Function
Filter
Filter iterates over the slice and apply ConditionIterator to every item. Returns new slice.
arrays.go:68
↓ 3 callers
Function
Find
Find iterates over the slice and apply ConditionIterator to every item. Returns first item that meet ConditionIterator or nil otherwise.
arrays.go:58
↓ 3 callers
Function
InRangeFloat32
InRangeFloat32 returns true if value lies between left and right border
numerics.go:55
↓ 3 callers
Function
IsDNSName
IsDNSName will validate the given string as a DNS name
validator.go:675
↓ 3 callers
Function
IsISBN
IsISBN checks if the string is an ISBN (version 10 or 13). If version value is not equal to 10 or 13, it will be checks both variants.
validator.go:492
↓ 3 callers
Function
IsNatural
IsNatural returns true if value is natural number (positive and whole)
numerics.go:98
↓ 3 callers
Function
IsNegative
IsNegative returns true if value < 0
numerics.go:24
↓ 3 callers
Function
IsNonNegative
IsNonNegative returns true if value >= 0
numerics.go:34
↓ 3 callers
Function
IsNonPositive
IsNonPositive returns true if value <= 0
numerics.go:39
↓ 3 callers
Function
IsTime
IsTime checks if string is valid according to given format
validator.go:1274
↓ 3 callers
Function
Map
Map iterates over the slice and apply ResultIterator to every item. Returns new slice as a result.
arrays.go:49
↓ 3 callers
Function
Sign
Sign returns signum of number: 1 in case of value > 0, -1 in case of value < 0, 0 otherwise
numerics.go:13
↓ 3 callers
Function
ToBoolean
ToBoolean convert the input string to a boolean.
converter.go:79
↓ 3 callers
Function
ToJSON
ToJSON convert the input to a valid JSON string
converter.go:17
↓ 3 callers
Function
ToString
ToString convert the input to a string.
converter.go:11
↓ 3 callers
Function
Trim
Trim trims characters from both sides of the input. If second argument is empty, it will remove spaces.
utils.go:49
↓ 3 callers
Function
buildPadStr
PadString either left, right or both sides. Note that padding string can be unicode and more then one character
utils.go:230
↓ 3 callers
Function
prependPathToErrors
(err error, path string)
validator.go:980
↓ 2 callers
Function
BlackList
BlackList removes characters that appear in the blacklist.
utils.go:61
↓ 2 callers
Function
ErrorByField
ErrorByField returns error for specified field of the struct validated by ValidateStruct or empty string if there are no errors or this field doesn't
validator.go:1726
↓ 2 callers
Function
ErrorsByField
ErrorsByField returns map of errors of the struct validated by ValidateStruct or empty map if there are no errors.
validator.go:1735
↓ 2 callers
Method
Get
(name string)
types.go:94
↓ 2 callers
Function
GetLines
GetLines splits string by "\n" and return array of lines
utils.go:133
↓ 2 callers
Function
IsBase64
IsBase64 checks if a string is base64 encoded.
validator.go:580
↓ 2 callers
Function
IsDivisibleBy
IsDivisibleBy checks if the string is a number that's divisible by another. If second argument is not valid integer or zero, it's return false. Otherw
validator.go:309
↓ 2 callers
Function
IsEmail
IsEmail checks if the string is an email.
validator.go:67
↓ 2 callers
Function
IsIn
IsIn checks if string str is a member of the set of strings params
validator.go:1408
↓ 2 callers
Function
IsInt
IsInt checks if the string is an integer. Empty string is valid.
validator.go:294
↓ 2 callers
Function
IsPort
IsPort checks if a string represents a valid port
validator.go:812
↓ 2 callers
Function
IsRsaPublicKey
IsRsaPublicKey checks if a string is valid public key with provided length
validator.go:919
↓ 2 callers
Function
LeftTrim
LeftTrim trims characters from the left side of the input. If second argument is empty, it will remove leading spaces.
utils.go:29
↓ 2 callers
Method
Len
()
validator.go:1762
↓ 2 callers
Function
RightTrim
RightTrim trims characters from the right side of the input. If second argument is empty, it will remove trailing spaces.
utils.go:39
↓ 2 callers
Function
StringLength
StringLength checks string's length (including multi byte strings)
validator.go:1346
↓ 2 callers
Function
WhiteList
WhiteList removes characters that do not appear in the whitelist.
utils.go:54
↓ 2 callers
Function
parseTagIntoMap
parseTagIntoMap parses a struct tag `valid:required~Some error message,length(2|3)` into map[string]string{"required": "Some error message", "length(2
validator.go:1212
↓ 2 callers
Function
typeCheck
(v reflect.Value, t reflect.StructField, o reflect.Value, options tagOptionsMap)
validator.go:1438
↓ 1 callers
Function
ByteLength
ByteLength checks string's length
validator.go:1309
↓ 1 callers
Function
CamelCaseToUnderscore
CamelCaseToUnderscore converts from camel case form to underscore separated form. Ex.: MyFunc => my_func
utils.go:107
↓ 1 callers
Method
Error
Error returns string equivalent for reflect.Type
validator.go:1758
↓ 1 callers
Function
Every
Every validates that every item of array corresponds to ConditionIterator. Returns boolean.
arrays.go:25
↓ 1 callers
Function
GetLine
GetLine returns specified line of multiline string
utils.go:138
↓ 1 callers
Function
HasLowerCase
HasLowerCase checks if the string contains at least 1 lowercase. Empty string is valid.
validator.go:278
↓ 1 callers
Function
HasUpperCase
HasUpperCase checks if the string contains as least 1 uppercase. Empty string is valid.
validator.go:286
↓ 1 callers
Function
HasWhitespace
HasWhitespace checks if the string contains any whitespace
validator.go:335
↓ 1 callers
Function
HasWhitespaceOnly
HasWhitespaceOnly checks the string only contains whitespace
validator.go:330
↓ 1 callers
Function
IsASCII
IsASCII checks if the string contains ASCII chars only. Empty string is valid.
validator.go:540
↓ 1 callers
Function
IsAlpha
IsAlpha checks if the string contains only letters (a-zA-Z). Empty string is valid.
validator.go:150
↓ 1 callers
Function
IsAlphanumeric
IsAlphanumeric checks if the string contains only letters and numbers. Empty string is valid.
validator.go:174
↓ 1 callers
Function
IsByteLength
IsByteLength checks if the string's length (in bytes) falls in a range.
validator.go:340
↓ 1 callers
Function
IsCIDR
IsCIDR checks if the string is an valid CIDR notiation (IPV4 & IPV6)
validator.go:832
↓ 1 callers
Function
IsCreditCard
IsCreditCard checks if the string is a credit card.
validator.go:452
↓ 1 callers
Function
IsDataURI
IsDataURI checks if a string is base64 encoded data URI such as an image
validator.go:621
↓ 1 callers
Function
IsDialString
IsDialString validates the given string for usage with the various Dial() functions
validator.go:798
↓ 1 callers
Function
IsE164
(str string)
validator.go:1767
↓ 1 callers
Function
IsExistingEmail
IsExistingEmail checks if the string is an email of existing domain
validator.go:73
↓ 1 callers
Function
IsFilePath
IsFilePath checks is a string is Win or Unix file path and returns it's type.
validator.go:585
↓ 1 callers
Function
IsFloat
IsFloat checks if the string is a float.
validator.go:302
↓ 1 callers
Function
IsFullWidth
IsFullWidth checks if the string contains any full-width chars. Empty string is valid.
validator.go:556
↓ 1 callers
Function
IsHalfWidth
IsHalfWidth checks if the string contains any half-width chars. Empty string is valid.
validator.go:564
↓ 1 callers
Function
IsHexadecimal
IsHexadecimal checks if the string is a hexadecimal number.
validator.go:247
↓ 1 callers
Function
IsHexcolor
IsHexcolor checks if the string is a hexadecimal color.
validator.go:252
↓ 1 callers
Function
IsHost
IsHost checks if the string is a valid IP (both v4 and v6) or a valid DNS name
validator.go:851
↓ 1 callers
Function
IsIMEI
IsIMEI checks if a string is valid IMEI
validator.go:871
↓ 1 callers
Function
IsIMSI
IsIMSI checks if a string is valid IMSI
validator.go:876
↓ 1 callers
Function
IsIPv4
IsIPv4 checks if the string is an IP version 4.
validator.go:820
↓ 1 callers
Function
IsIPv6
IsIPv6 checks if the string is an IP version 6.
validator.go:826
↓ 1 callers
Function
IsISBN10
IsISBN10 checks if the string is an ISBN version 10.
validator.go:481
↓ 1 callers
Function
IsISBN13
IsISBN13 checks if the string is an ISBN version 13.
validator.go:486
↓ 1 callers
Function
IsISO3166Alpha2
IsISO3166Alpha2 checks if a string is valid two-letter country code
validator.go:635
↓ 1 callers
Function
IsISO3166Alpha3
IsISO3166Alpha3 checks if a string is valid three-letter country code
validator.go:645
↓ 1 callers
Function
IsISO4217
IsISO4217 checks if string is valid ISO currency code
validator.go:1298
↓ 1 callers
Function
IsISO693Alpha2
IsISO693Alpha2 checks if a string is valid two-letter language code
validator.go:655
↓ 1 callers
Function
IsISO693Alpha3b
IsISO693Alpha3b checks if a string is valid three-letter language code
validator.go:665
↓ 1 callers
Function
IsJSON
IsJSON checks if the string is valid JSON (note: uses json.Unmarshal).
validator.go:526
↓ 1 callers
Function
IsLatitude
IsLatitude checks if a string is valid latitude.
validator.go:861
↓ 1 callers
Function
IsLongitude
IsLongitude checks if a string is valid longitude.
validator.go:866
↓ 1 callers
Function
IsLowerCase
IsLowerCase checks if the string is lowercase. Empty string is valid.
validator.go:262
next →
1–100 of 388, ranked by callers