MCPcopy Create free account

hub / github.com/connor4312/validity / functions

Functions134 in github.com/connor4312/validity

↓ 61 callersFunctionValidateStruct
This function converts the struct into a map, then runs ValidateMap() on it. See ValidateMap's documentation for usage details.
validity.go:89
↓ 7 callersMethodtoInt
Converts a string to an integer. That's all there is!
int_checker.go:15
↓ 5 callersFunctionValidateMap
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 callersMethodcheckRegexp
(r string)
string_checker.go:39
↓ 5 callersMethodtoInt
(s string)
string_checker.go:33
↓ 4 callersMethodAddError
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 callersMethodtoFloat
Converts a string to an float. That's all there is!
float_checker.go:15
↓ 3 callersFunctionGetCheckerErrors
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 callersMethodParseInt
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 callersMethodparseIP
()
string_checker.go:45
↓ 3 callersMethodtoInt
Converts a string to an integer. That's all there is!
float_checker.go:22
↓ 2 callersMethodGetKey
()
checker.go:13
↓ 2 callersFunctionfirstToUpper
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 callersMethodgetDigits
Gets the number of digits from the item.
int_checker.go:22
↓ 2 callersMethodgetDigits
Gets the number of non-decimal digits from the item.
float_checker.go:29
↓ 1 callersMethodAddErrors
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 callersMethodGetErrors
()
checker.go:15
↓ 1 callersMethodGetItem
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 callersMethodParseFloat
Converter the given value to a float, using the same method as was used to convert to int.
queue.go:111
↓ 1 callersMethodRun
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 callersMethodRunCheckers
Runs the checkers, for the second stage. See Run() for explaination.
queue.go:63
↓ 1 callersMethodRunParsers
Runs the parsers, for the second stage. See Run() for explaination.
queue.go:46
↓ 1 callersFunctionValidateStructTags
(s interface{})
validity.go:93
↓ 1 callersFunctioncallIn
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 callersFunctioninSlice
Checks to see if the given string appears in the slice.
util.go:54
↓ 1 callersFunctioninferValidationType
(t interface{})
validity.go:76
↓ 1 callersFunctionsnakeToCamel
Converts a snake_cased string to a camelCased one.
util.go:23
↓ 1 callersFunctionsnakeToStudly
Converts a snake_cased string to a StudlyCased one.
util.go:35
MethodGetErrors
()
string_checker.go:29
MethodGetErrors
()
int_checker.go:40
MethodGetErrors
()
float_checker.go:45
MethodGetItem
()
string_checker.go:21
MethodGetItem
()
int_checker.go:32
MethodGetItem
()
float_checker.go:37
MethodGetKey
()
string_checker.go:17
MethodGetKey
()
int_checker.go:28
MethodGetKey
()
float_checker.go:33
MethodGetRules
()
string_checker.go:25
MethodGetRules
()
int_checker.go:36
MethodGetRules
()
checker.go:14
MethodGetRules
()
float_checker.go:41
MethodParseString
Converts the given value to a string.
queue.go:124
FunctionTestAllowsOptional
(t *testing.T)
validity_test.go:87
FunctionTestEnforcesRequired
(t *testing.T)
validity_test.go:77
FunctionTestFloatValidateAcceptedFail
(t *testing.T)
float_checker_test.go:16
FunctionTestFloatValidateAcceptedPass
(t *testing.T)
float_checker_test.go:7
FunctionTestFloatValidateBetweenFail
(t *testing.T)
float_checker_test.go:67
FunctionTestFloatValidateBetweenFailLower
(t *testing.T)
float_checker_test.go:37
FunctionTestFloatValidateBetweenFailUpper
(t *testing.T)
float_checker_test.go:46
FunctionTestFloatValidateBetweenPass
(t *testing.T)
float_checker_test.go:28
FunctionTestFloatValidateDigitsBetweenFailLower
(t *testing.T)
float_checker_test.go:88
FunctionTestFloatValidateDigitsBetweenFailUpper
(t *testing.T)
float_checker_test.go:97
FunctionTestFloatValidateDigitsBetweenPass
(t *testing.T)
float_checker_test.go:79
FunctionTestFloatValidateDigitsPass
(t *testing.T)
float_checker_test.go:58
FunctionTestFloatValidateMaxFail
(t *testing.T)
float_checker_test.go:118
FunctionTestFloatValidateMaxPass
(t *testing.T)
float_checker_test.go:109
FunctionTestFloatValidateMinFail
(t *testing.T)
float_checker_test.go:139
FunctionTestFloatValidateMinPass
(t *testing.T)
float_checker_test.go:130
FunctionTestHandlesBasicTypeConversions
(t *testing.T)
validity_test.go:57
FunctionTestHandlesInvalidTypeConversions
(t *testing.T)
validity_test.go:67
FunctionTestIntValidateAcceptedFail
(t *testing.T)
int_checker_test.go:16
FunctionTestIntValidateAcceptedPass
(t *testing.T)
int_checker_test.go:7
FunctionTestIntValidateBetweenFail
(t *testing.T)
int_checker_test.go:67
FunctionTestIntValidateBetweenFailLower
(t *testing.T)
int_checker_test.go:37
FunctionTestIntValidateBetweenFailUpper
(t *testing.T)
int_checker_test.go:46
FunctionTestIntValidateBetweenPass
(t *testing.T)
int_checker_test.go:28
FunctionTestIntValidateDigitsBetweenFailLower
(t *testing.T)
int_checker_test.go:88
FunctionTestIntValidateDigitsBetweenFailUpper
(t *testing.T)
int_checker_test.go:97
FunctionTestIntValidateDigitsBetweenPass
(t *testing.T)
int_checker_test.go:79
FunctionTestIntValidateDigitsPass
(t *testing.T)
int_checker_test.go:58
FunctionTestIntValidateMaxFail
(t *testing.T)
int_checker_test.go:118
FunctionTestIntValidateMaxPass
(t *testing.T)
int_checker_test.go:109
FunctionTestIntValidateMinFail
(t *testing.T)
int_checker_test.go:139
FunctionTestIntValidateMinPass
(t *testing.T)
int_checker_test.go:130
FunctionTestReturnsProperResultsOnFailedValidators
(t *testing.T)
validity_test.go:115
FunctionTestReturnsProperResultsOnSuccess
(t *testing.T)
validity_test.go:130
FunctionTestReturnsProperResultsOnTypeFail
(t *testing.T)
validity_test.go:98
FunctionTestStringValidateAcceptedFail
(t *testing.T)
string_checker_test.go:16
FunctionTestStringValidateAcceptedPass
(t *testing.T)
string_checker_test.go:7
FunctionTestStringValidateAlphaDashFail
(t *testing.T)
string_checker_test.go:58
FunctionTestStringValidateAlphaDashPass
(t *testing.T)
string_checker_test.go:49
FunctionTestStringValidateAlphaFail
(t *testing.T)
string_checker_test.go:37
FunctionTestStringValidateAlphaNumFail
(t *testing.T)
string_checker_test.go:79
FunctionTestStringValidateAlphaNumPass
(t *testing.T)
string_checker_test.go:70
FunctionTestStringValidateAlphaPass
(t *testing.T)
string_checker_test.go:28
FunctionTestStringValidateBetweenFailLower
(t *testing.T)
string_checker_test.go:100
FunctionTestStringValidateBetweenFailUpper
(t *testing.T)
string_checker_test.go:109
FunctionTestStringValidateBetweenPass
(t *testing.T)
string_checker_test.go:91
FunctionTestStringValidateDateFail
(t *testing.T)
string_checker_test.go:130
FunctionTestStringValidateDatePass
(t *testing.T)
string_checker_test.go:121
FunctionTestStringValidateEmailFail
(t *testing.T)
string_checker_test.go:151
FunctionTestStringValidateEmailPass
(t *testing.T)
string_checker_test.go:142
FunctionTestStringValidateIpv4Fail
(t *testing.T)
string_checker_test.go:172
FunctionTestStringValidateIpv4Pass
(t *testing.T)
string_checker_test.go:163
FunctionTestStringValidateIpv6Fail
(t *testing.T)
string_checker_test.go:193
FunctionTestStringValidateIpv6Pass
(t *testing.T)
string_checker_test.go:184
FunctionTestStringValidateMaxFail
(t *testing.T)
string_checker_test.go:214
FunctionTestStringValidateMaxPass
(t *testing.T)
string_checker_test.go:205
FunctionTestStringValidateMinFail
(t *testing.T)
string_checker_test.go:235
FunctionTestStringValidateMinPass
(t *testing.T)
string_checker_test.go:226
next →1–100 of 134, ranked by callers