marcelobiao
e0e8fed530
add cpf validation
2 years ago
Lauris BH
f09500fca7
Fix support for aliased time.Time types ( #890 )
3 years ago
Dean Karn
456221b630
Fix time.Duration parsing for int param ( #678 )
...
This fixes an issue where if the param of a time.Durtion type is specified
as an integer, denoting nanosecond precision, instead of time duration
string the validation would panic.
the fixes ensures it falls back to the previous expected behaviour.
4 years ago
Elias Rodrigues
1cbd3081e4
Add function asIntFromType
4 years ago
Elias Rodrigues
94470e68f3
Add function asIntFromTimeDuration()
4 years ago
Dmitry M. Gavrovsky
dfc652373a
Added boolean type support for “eq” validator
5 years ago
Dean Karn
c0f05c7b3d
fix required_*
5 years ago
Dean Karn
5e036656b8
Add hostname_rfc1123 validation
7 years ago
Dean Karn
42a0d6df3b
some minor perf with recursion
8 years ago
Dean Karn
a7ca4a1d32
add default translations for "en"
...
- need help creating more.
8 years ago
joeybloggs
e0e1af6a61
working instance
8 years ago
joeybloggs
77f59a0ea0
corrected some spelling mistakes in documentation
8 years ago
joeybloggs
7a080ada5b
Fix issue with omitempty combined with nullable types in combination with a default static value set as the value
...
fix for issue-#249
8 years ago
joeybloggs
43f7b7d61a
save some bytes
8 years ago
joeybloggs
210684a828
code cleanup + add missing tag cache with FieldWith func
...
Still looking good:
```
benchmark old ns/op new ns/op delta
BenchmarkFieldSuccess-4 167 119 -28.74%
BenchmarkFieldFailure-4 701 650 -7.28%
BenchmarkFieldDiveSuccess-4 2937 2482 -15.49%
BenchmarkFieldDiveFailure-4 3536 3046 -13.86%
BenchmarkFieldCustomTypeSuccess-4 341 296 -13.20%
BenchmarkFieldCustomTypeFailure-4 679 666 -1.91%
BenchmarkFieldOrTagSuccess-4 1157 1124 -2.85%
BenchmarkFieldOrTagFailure-4 1109 1036 -6.58%
BenchmarkStructLevelValidationSuccess-4 694 554 -20.17%
BenchmarkStructLevelValidationFailure-4 1311 558 -57.44%
BenchmarkStructSimpleCustomTypeSuccess-4 894 654 -26.85%
BenchmarkStructSimpleCustomTypeFailure-4 1496 1286 -14.04%
BenchmarkStructPartialSuccess-4 1229 1062 -13.59%
BenchmarkStructPartialFailure-4 1838 1639 -10.83%
BenchmarkStructExceptSuccess-4 961 919 -4.37%
BenchmarkStructExceptFailure-4 1218 1072 -11.99%
BenchmarkStructSimpleCrossFieldSuccess-4 954 800 -16.14%
BenchmarkStructSimpleCrossFieldFailure-4 1569 1372 -12.56%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4 1588 1274 -19.77%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4 2217 1901 -14.25%
BenchmarkStructSimpleSuccess-4 925 512 -44.65%
BenchmarkStructSimpleFailure-4 1650 1318 -20.12%
BenchmarkStructSimpleSuccessParallel-4 261 144 -44.83%
BenchmarkStructSimpleFailureParallel-4 758 581 -23.35%
BenchmarkStructComplexSuccess-4 5868 3451 -41.19%
BenchmarkStructComplexFailure-4 10767 8351 -22.44%
BenchmarkStructComplexSuccessParallel-4 1559 1065 -31.69%
BenchmarkStructComplexFailureParallel-4 3747 2916 -22.18%
```
8 years ago
joeybloggs
c0a414dc9e
initial un-refined new caching system
8 years ago
joeybloggs
cdfcf16a86
fix some minor listing.
8 years ago
joeybloggs
0862513fbf
Add some string check optimizations
...
* was using len(string) for some blank checks instead of string == ""
9 years ago
joeybloggs
e019c28542
Add struct field + associated tags caching
...
* This essentially reduces the number of cache tag lookups for a structs fields to one.
9 years ago
joeybloggs
94182a2199
init struct cache changes
9 years ago
joeybloggs
d451d57023
Update benchmarks + correct benchmark error
...
* Fix error with BenchmarkFieldFailure, it was recording a successful
run.
* Update some benchmarks, they were showing allocations for the creation
of the data not just processing it.
9 years ago
joeybloggs
cab69bdd13
Add minor optimization for structonly & nostructlevel checks
9 years ago
joeybloggs
24c1c6819f
Add nostructlevel tag
...
* nostructlevel - Same as structonly tag except that any struct level
validations will not run.
9 years ago
joeybloggs
1570c9b6b3
Update Error message quotes to single quotes
...
* helps reduce noise when transmitting errors via JSON.
for #199
9 years ago
joeybloggs
830d270923
Expose Methods for Custom functions
...
Exposed previously unexposed functions for use within custom functions.
* ExtractType
* GetStructFieldOK
9 years ago
joeybloggs
10cf645b91
reorganization of code + variables to more appropriate structs
9 years ago
joeybloggs
4807bf93bb
unexpose baked in validators map for safety.
9 years ago
joeybloggs
c293315337
updated tag caching for maximum performance
9 years ago
joeybloggs
a964f5384a
Completed 100% test coverage for alis registration
9 years ago
joeybloggs
407aac458f
Update Alias logic
...
- Unexport Alias Map in order to preserve any custom user aliases that
may conflict with new aliases added to the library itself....need to
copy them for each new validator.
- update error to report alias tag as the error tag and add actualTag to
know what it would have actually been.
9 years ago
joeybloggs
2cda50fb41
Add Tag Alias + basic tests
...
so far so good
9 years ago
joeybloggs
14b90946b3
Backport v7 updates
...
backporting v7 updates for the near released v7.
9 years ago
joeybloggs
656ae32e8b
Updated PanicMatches after assertion library updates
...
now panic less, instead of panicing when data types do not match
in the field and cross field validations, the validation just
fails, because it's true i.e. does nil != 5 pass
or does nil == "string" nope fail
9 years ago
joeybloggs
8ff687aae4
code cleanup
9 years ago
joeybloggs
cd50c5e085
Added necsfield method + tests
9 years ago
joeybloggs
3a0791591a
Add cross struct map support for all types not just string
9 years ago
joeybloggs
2fe52ca08f
finish eqcsfield + test coverage
9 years ago
joeybloggs
d19088f865
Code Cleanup + some renaming
9 years ago
joeybloggs
2ea9043764
update to handle nested map + Array + Slice structs
9 years ago
joeybloggs
3ab458c80c
Updates
...
Split out Type checking.
Add Cross Field determination function for future automatic cross struct
namespace field validation.
9 years ago