Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/connor4312/validity
/ functions
Functions
134 in github.com/connor4312/validity
⨍
Functions
134
◇
Types & classes
10
↓ 61 callers
Function
ValidateStruct
This function converts the struct into a map, then runs ValidateMap() on it. See ValidateMap's documentation for usage details.
validity.go:89
↓ 7 callers
Method
toInt
Converts a string to an integer. That's all there is!
int_checker.go:15
↓ 5 callers
Function
ValidateMap
Validates a map against a set of rules. "Data" is obviously a map of string keys to mixed type values, while rules is an instance of the rules to vali
validity.go:119
↓ 5 callers
Method
checkRegexp
(r string)
string_checker.go:39
↓ 5 callers
Method
toInt
(s string)
string_checker.go:33
↓ 4 callers
Method
AddError
Calling AddError inserts an error into the Results.Error, with the specified key. If there are already more than zero errors for the key, then the err
queue.go:79
↓ 4 callers
Method
toFloat
Converts a string to an float. That's all there is!
float_checker.go:15
↓ 3 callers
Function
GetCheckerErrors
GetErrors runs the validation! What it does is, for each validation rule in the format "rule:arg1,arg2". Surrounding spaces will be trimmed out. It at
checker.go:24
↓ 3 callers
Method
ParseInt
Converts the given value to an integer. Parses it as a string. Not super amazing, but the most elegant solution that I was able to find. Before we use
queue.go:98
↓ 3 callers
Method
parseIP
()
string_checker.go:45
↓ 3 callers
Method
toInt
Converts a string to an integer. That's all there is!
float_checker.go:22
↓ 2 callers
Method
GetKey
()
checker.go:13
↓ 2 callers
Function
firstToUpper
Uppercases the first letter of the given string. This reasonably nice solution is from kortschak on the go-nuts mailing list!
util.go:11
↓ 2 callers
Method
getDigits
Gets the number of digits from the item.
int_checker.go:22
↓ 2 callers
Method
getDigits
Gets the number of non-decimal digits from the item.
float_checker.go:29
↓ 1 callers
Method
AddErrors
Inserts a list of errors for the given key into the Results.Error. Any existing errors are not replaced, only appended to.
queue.go:90
↓ 1 callers
Method
GetErrors
()
checker.go:15
↓ 1 callers
Method
GetItem
GetErrors is the method which is actually called to run validation. It should return a slice of validation rules which are invalid, or nil if there ar
checker.go:12
↓ 1 callers
Method
ParseFloat
Converter the given value to a float, using the same method as was used to convert to int.
queue.go:111
↓ 1 callers
Method
Run
Run is reponsible for resetting the results, then running parsers/checkers. The actual validation occurs in two stages. First, the data is run through
queue.go:36
↓ 1 callers
Method
RunCheckers
Runs the checkers, for the second stage. See Run() for explaination.
queue.go:63
↓ 1 callers
Method
RunParsers
Runs the parsers, for the second stage. See Run() for explaination.
queue.go:46
↓ 1 callers
Function
ValidateStructTags
(s interface{})
validity.go:93
↓ 1 callers
Function
callIn
Calls the function `name` on the map `m` with the given splat of arguments, and return the result (if possible). Returns an error in the event of a pa
util.go:41
↓ 1 callers
Function
inSlice
Checks to see if the given string appears in the slice.
util.go:54
↓ 1 callers
Function
inferValidationType
(t interface{})
validity.go:76
↓ 1 callers
Function
snakeToCamel
Converts a snake_cased string to a camelCased one.
util.go:23
↓ 1 callers
Function
snakeToStudly
Converts a snake_cased string to a StudlyCased one.
util.go:35
Method
GetErrors
()
string_checker.go:29
Method
GetErrors
()
int_checker.go:40
Method
GetErrors
()
float_checker.go:45
Method
GetItem
()
string_checker.go:21
Method
GetItem
()
int_checker.go:32
Method
GetItem
()
float_checker.go:37
Method
GetKey
()
string_checker.go:17
Method
GetKey
()
int_checker.go:28
Method
GetKey
()
float_checker.go:33
Method
GetRules
()
string_checker.go:25
Method
GetRules
()
int_checker.go:36
Method
GetRules
()
checker.go:14
Method
GetRules
()
float_checker.go:41
Method
ParseString
Converts the given value to a string.
queue.go:124
Function
TestAllowsOptional
(t *testing.T)
validity_test.go:87
Function
TestEnforcesRequired
(t *testing.T)
validity_test.go:77
Function
TestFloatValidateAcceptedFail
(t *testing.T)
float_checker_test.go:16
Function
TestFloatValidateAcceptedPass
(t *testing.T)
float_checker_test.go:7
Function
TestFloatValidateBetweenFail
(t *testing.T)
float_checker_test.go:67
Function
TestFloatValidateBetweenFailLower
(t *testing.T)
float_checker_test.go:37
Function
TestFloatValidateBetweenFailUpper
(t *testing.T)
float_checker_test.go:46
Function
TestFloatValidateBetweenPass
(t *testing.T)
float_checker_test.go:28
Function
TestFloatValidateDigitsBetweenFailLower
(t *testing.T)
float_checker_test.go:88
Function
TestFloatValidateDigitsBetweenFailUpper
(t *testing.T)
float_checker_test.go:97
Function
TestFloatValidateDigitsBetweenPass
(t *testing.T)
float_checker_test.go:79
Function
TestFloatValidateDigitsPass
(t *testing.T)
float_checker_test.go:58
Function
TestFloatValidateMaxFail
(t *testing.T)
float_checker_test.go:118
Function
TestFloatValidateMaxPass
(t *testing.T)
float_checker_test.go:109
Function
TestFloatValidateMinFail
(t *testing.T)
float_checker_test.go:139
Function
TestFloatValidateMinPass
(t *testing.T)
float_checker_test.go:130
Function
TestHandlesBasicTypeConversions
(t *testing.T)
validity_test.go:57
Function
TestHandlesInvalidTypeConversions
(t *testing.T)
validity_test.go:67
Function
TestIntValidateAcceptedFail
(t *testing.T)
int_checker_test.go:16
Function
TestIntValidateAcceptedPass
(t *testing.T)
int_checker_test.go:7
Function
TestIntValidateBetweenFail
(t *testing.T)
int_checker_test.go:67
Function
TestIntValidateBetweenFailLower
(t *testing.T)
int_checker_test.go:37
Function
TestIntValidateBetweenFailUpper
(t *testing.T)
int_checker_test.go:46
Function
TestIntValidateBetweenPass
(t *testing.T)
int_checker_test.go:28
Function
TestIntValidateDigitsBetweenFailLower
(t *testing.T)
int_checker_test.go:88
Function
TestIntValidateDigitsBetweenFailUpper
(t *testing.T)
int_checker_test.go:97
Function
TestIntValidateDigitsBetweenPass
(t *testing.T)
int_checker_test.go:79
Function
TestIntValidateDigitsPass
(t *testing.T)
int_checker_test.go:58
Function
TestIntValidateMaxFail
(t *testing.T)
int_checker_test.go:118
Function
TestIntValidateMaxPass
(t *testing.T)
int_checker_test.go:109
Function
TestIntValidateMinFail
(t *testing.T)
int_checker_test.go:139
Function
TestIntValidateMinPass
(t *testing.T)
int_checker_test.go:130
Function
TestReturnsProperResultsOnFailedValidators
(t *testing.T)
validity_test.go:115
Function
TestReturnsProperResultsOnSuccess
(t *testing.T)
validity_test.go:130
Function
TestReturnsProperResultsOnTypeFail
(t *testing.T)
validity_test.go:98
Function
TestStringValidateAcceptedFail
(t *testing.T)
string_checker_test.go:16
Function
TestStringValidateAcceptedPass
(t *testing.T)
string_checker_test.go:7
Function
TestStringValidateAlphaDashFail
(t *testing.T)
string_checker_test.go:58
Function
TestStringValidateAlphaDashPass
(t *testing.T)
string_checker_test.go:49
Function
TestStringValidateAlphaFail
(t *testing.T)
string_checker_test.go:37
Function
TestStringValidateAlphaNumFail
(t *testing.T)
string_checker_test.go:79
Function
TestStringValidateAlphaNumPass
(t *testing.T)
string_checker_test.go:70
Function
TestStringValidateAlphaPass
(t *testing.T)
string_checker_test.go:28
Function
TestStringValidateBetweenFailLower
(t *testing.T)
string_checker_test.go:100
Function
TestStringValidateBetweenFailUpper
(t *testing.T)
string_checker_test.go:109
Function
TestStringValidateBetweenPass
(t *testing.T)
string_checker_test.go:91
Function
TestStringValidateDateFail
(t *testing.T)
string_checker_test.go:130
Function
TestStringValidateDatePass
(t *testing.T)
string_checker_test.go:121
Function
TestStringValidateEmailFail
(t *testing.T)
string_checker_test.go:151
Function
TestStringValidateEmailPass
(t *testing.T)
string_checker_test.go:142
Function
TestStringValidateIpv4Fail
(t *testing.T)
string_checker_test.go:172
Function
TestStringValidateIpv4Pass
(t *testing.T)
string_checker_test.go:163
Function
TestStringValidateIpv6Fail
(t *testing.T)
string_checker_test.go:193
Function
TestStringValidateIpv6Pass
(t *testing.T)
string_checker_test.go:184
Function
TestStringValidateMaxFail
(t *testing.T)
string_checker_test.go:214
Function
TestStringValidateMaxPass
(t *testing.T)
string_checker_test.go:205
Function
TestStringValidateMinFail
(t *testing.T)
string_checker_test.go:235
Function
TestStringValidateMinPass
(t *testing.T)
string_checker_test.go:226
next →
1–100 of 134, ranked by callers