MCPcopy Create free account

hub / github.com/asaskevich/govalidator / functions

Functions388 in github.com/asaskevich/govalidator

↓ 32 callersFunctionValidateStruct
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 callersFunctionIsNull
IsNull checks if the string is null.
validator.go:320
↓ 18 callersFunctionIsHash
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 callersFunctionToInt
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 callersMethodError
()
error.go:36
↓ 7 callersFunctionrandomArray
(n int)
arrays_benchmark_test.go:14
↓ 6 callersFunctionSetFieldsRequiredByDefault
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 callersFunctionToFloat
ToFloat convert the input string to a float, or 0.0 if the input is not a float.
converter.go:26
↓ 4 callersFunctionInRange
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 callersFunctionInRangeFloat64
InRangeFloat64 returns true if value lies between left and right border
numerics.go:63
↓ 4 callersFunctionInRangeInt
InRangeInt returns true if value lies between left and right border
numerics.go:44
↓ 4 callersFunctionIsIP
IsIP checks if a string is either IP version 4 or 6. Alias for `net.ParseIP`
validator.go:807
↓ 4 callersFunctionIsPositive
IsPositive returns true if value > 0
numerics.go:29
↓ 4 callersFunctionIsWhole
IsWhole returns true if value is whole number
numerics.go:93
↓ 4 callersFunctionMatches
Matches checks if string matches the pattern (pattern is regular expression) In case of error return false
utils.go:22
↓ 4 callersFunctionReplacePattern
ReplacePattern replaces regular expression pattern in string
utils.go:80
↓ 4 callersMethodSet
(name string, ctv CustomTypeValidator)
types.go:101
↓ 3 callersFunctionAbs
Abs returns absolute value of number
numerics.go:8
↓ 3 callersFunctionContains
Contains checks if the string contains the substring.
utils.go:16
↓ 3 callersFunctionCount
Count iterates over the slice and apply ConditionIterator to every item. Returns count of items that meets ConditionIterator.
arrays.go:79
↓ 3 callersFunctionEach
Each iterates over the slice and apply Iterator to every item
arrays.go:42
↓ 3 callersMethodErrors
Errors returns itself.
error.go:12
↓ 3 callersFunctionFilter
Filter iterates over the slice and apply ConditionIterator to every item. Returns new slice.
arrays.go:68
↓ 3 callersFunctionFind
Find iterates over the slice and apply ConditionIterator to every item. Returns first item that meet ConditionIterator or nil otherwise.
arrays.go:58
↓ 3 callersFunctionInRangeFloat32
InRangeFloat32 returns true if value lies between left and right border
numerics.go:55
↓ 3 callersFunctionIsDNSName
IsDNSName will validate the given string as a DNS name
validator.go:675
↓ 3 callersFunctionIsISBN
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 callersFunctionIsNatural
IsNatural returns true if value is natural number (positive and whole)
numerics.go:98
↓ 3 callersFunctionIsNegative
IsNegative returns true if value < 0
numerics.go:24
↓ 3 callersFunctionIsNonNegative
IsNonNegative returns true if value >= 0
numerics.go:34
↓ 3 callersFunctionIsNonPositive
IsNonPositive returns true if value <= 0
numerics.go:39
↓ 3 callersFunctionIsTime
IsTime checks if string is valid according to given format
validator.go:1274
↓ 3 callersFunctionMap
Map iterates over the slice and apply ResultIterator to every item. Returns new slice as a result.
arrays.go:49
↓ 3 callersFunctionSign
Sign returns signum of number: 1 in case of value > 0, -1 in case of value < 0, 0 otherwise
numerics.go:13
↓ 3 callersFunctionToBoolean
ToBoolean convert the input string to a boolean.
converter.go:79
↓ 3 callersFunctionToJSON
ToJSON convert the input to a valid JSON string
converter.go:17
↓ 3 callersFunctionToString
ToString convert the input to a string.
converter.go:11
↓ 3 callersFunctionTrim
Trim trims characters from both sides of the input. If second argument is empty, it will remove spaces.
utils.go:49
↓ 3 callersFunctionbuildPadStr
PadString either left, right or both sides. Note that padding string can be unicode and more then one character
utils.go:230
↓ 3 callersFunctionprependPathToErrors
(err error, path string)
validator.go:980
↓ 2 callersFunctionBlackList
BlackList removes characters that appear in the blacklist.
utils.go:61
↓ 2 callersFunctionErrorByField
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 callersFunctionErrorsByField
ErrorsByField returns map of errors of the struct validated by ValidateStruct or empty map if there are no errors.
validator.go:1735
↓ 2 callersMethodGet
(name string)
types.go:94
↓ 2 callersFunctionGetLines
GetLines splits string by "\n" and return array of lines
utils.go:133
↓ 2 callersFunctionIsBase64
IsBase64 checks if a string is base64 encoded.
validator.go:580
↓ 2 callersFunctionIsDivisibleBy
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 callersFunctionIsEmail
IsEmail checks if the string is an email.
validator.go:67
↓ 2 callersFunctionIsIn
IsIn checks if string str is a member of the set of strings params
validator.go:1408
↓ 2 callersFunctionIsInt
IsInt checks if the string is an integer. Empty string is valid.
validator.go:294
↓ 2 callersFunctionIsPort
IsPort checks if a string represents a valid port
validator.go:812
↓ 2 callersFunctionIsRsaPublicKey
IsRsaPublicKey checks if a string is valid public key with provided length
validator.go:919
↓ 2 callersFunctionLeftTrim
LeftTrim trims characters from the left side of the input. If second argument is empty, it will remove leading spaces.
utils.go:29
↓ 2 callersMethodLen
()
validator.go:1762
↓ 2 callersFunctionRightTrim
RightTrim trims characters from the right side of the input. If second argument is empty, it will remove trailing spaces.
utils.go:39
↓ 2 callersFunctionStringLength
StringLength checks string's length (including multi byte strings)
validator.go:1346
↓ 2 callersFunctionWhiteList
WhiteList removes characters that do not appear in the whitelist.
utils.go:54
↓ 2 callersFunctionparseTagIntoMap
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 callersFunctiontypeCheck
(v reflect.Value, t reflect.StructField, o reflect.Value, options tagOptionsMap)
validator.go:1438
↓ 1 callersFunctionByteLength
ByteLength checks string's length
validator.go:1309
↓ 1 callersFunctionCamelCaseToUnderscore
CamelCaseToUnderscore converts from camel case form to underscore separated form. Ex.: MyFunc => my_func
utils.go:107
↓ 1 callersMethodError
Error returns string equivalent for reflect.Type
validator.go:1758
↓ 1 callersFunctionEvery
Every validates that every item of array corresponds to ConditionIterator. Returns boolean.
arrays.go:25
↓ 1 callersFunctionGetLine
GetLine returns specified line of multiline string
utils.go:138
↓ 1 callersFunctionHasLowerCase
HasLowerCase checks if the string contains at least 1 lowercase. Empty string is valid.
validator.go:278
↓ 1 callersFunctionHasUpperCase
HasUpperCase checks if the string contains as least 1 uppercase. Empty string is valid.
validator.go:286
↓ 1 callersFunctionHasWhitespace
HasWhitespace checks if the string contains any whitespace
validator.go:335
↓ 1 callersFunctionHasWhitespaceOnly
HasWhitespaceOnly checks the string only contains whitespace
validator.go:330
↓ 1 callersFunctionIsASCII
IsASCII checks if the string contains ASCII chars only. Empty string is valid.
validator.go:540
↓ 1 callersFunctionIsAlpha
IsAlpha checks if the string contains only letters (a-zA-Z). Empty string is valid.
validator.go:150
↓ 1 callersFunctionIsAlphanumeric
IsAlphanumeric checks if the string contains only letters and numbers. Empty string is valid.
validator.go:174
↓ 1 callersFunctionIsByteLength
IsByteLength checks if the string's length (in bytes) falls in a range.
validator.go:340
↓ 1 callersFunctionIsCIDR
IsCIDR checks if the string is an valid CIDR notiation (IPV4 & IPV6)
validator.go:832
↓ 1 callersFunctionIsCreditCard
IsCreditCard checks if the string is a credit card.
validator.go:452
↓ 1 callersFunctionIsDataURI
IsDataURI checks if a string is base64 encoded data URI such as an image
validator.go:621
↓ 1 callersFunctionIsDialString
IsDialString validates the given string for usage with the various Dial() functions
validator.go:798
↓ 1 callersFunctionIsE164
(str string)
validator.go:1767
↓ 1 callersFunctionIsExistingEmail
IsExistingEmail checks if the string is an email of existing domain
validator.go:73
↓ 1 callersFunctionIsFilePath
IsFilePath checks is a string is Win or Unix file path and returns it's type.
validator.go:585
↓ 1 callersFunctionIsFloat
IsFloat checks if the string is a float.
validator.go:302
↓ 1 callersFunctionIsFullWidth
IsFullWidth checks if the string contains any full-width chars. Empty string is valid.
validator.go:556
↓ 1 callersFunctionIsHalfWidth
IsHalfWidth checks if the string contains any half-width chars. Empty string is valid.
validator.go:564
↓ 1 callersFunctionIsHexadecimal
IsHexadecimal checks if the string is a hexadecimal number.
validator.go:247
↓ 1 callersFunctionIsHexcolor
IsHexcolor checks if the string is a hexadecimal color.
validator.go:252
↓ 1 callersFunctionIsHost
IsHost checks if the string is a valid IP (both v4 and v6) or a valid DNS name
validator.go:851
↓ 1 callersFunctionIsIMEI
IsIMEI checks if a string is valid IMEI
validator.go:871
↓ 1 callersFunctionIsIMSI
IsIMSI checks if a string is valid IMSI
validator.go:876
↓ 1 callersFunctionIsIPv4
IsIPv4 checks if the string is an IP version 4.
validator.go:820
↓ 1 callersFunctionIsIPv6
IsIPv6 checks if the string is an IP version 6.
validator.go:826
↓ 1 callersFunctionIsISBN10
IsISBN10 checks if the string is an ISBN version 10.
validator.go:481
↓ 1 callersFunctionIsISBN13
IsISBN13 checks if the string is an ISBN version 13.
validator.go:486
↓ 1 callersFunctionIsISO3166Alpha2
IsISO3166Alpha2 checks if a string is valid two-letter country code
validator.go:635
↓ 1 callersFunctionIsISO3166Alpha3
IsISO3166Alpha3 checks if a string is valid three-letter country code
validator.go:645
↓ 1 callersFunctionIsISO4217
IsISO4217 checks if string is valid ISO currency code
validator.go:1298
↓ 1 callersFunctionIsISO693Alpha2
IsISO693Alpha2 checks if a string is valid two-letter language code
validator.go:655
↓ 1 callersFunctionIsISO693Alpha3b
IsISO693Alpha3b checks if a string is valid three-letter language code
validator.go:665
↓ 1 callersFunctionIsJSON
IsJSON checks if the string is valid JSON (note: uses json.Unmarshal).
validator.go:526
↓ 1 callersFunctionIsLatitude
IsLatitude checks if a string is valid latitude.
validator.go:861
↓ 1 callersFunctionIsLongitude
IsLongitude checks if a string is valid longitude.
validator.go:866
↓ 1 callersFunctionIsLowerCase
IsLowerCase checks if the string is lowercase. Empty string is valid.
validator.go:262
next →1–100 of 388, ranked by callers