Bruno Lorenz
1669b6e0ee
Fixed "Assignment Branch Condition too high"
7 years ago
Bruno Lorenz
08796346a0
Append new validations
...
- hostname
- fqdn
7 years ago
Dean Karn
0f6f568263
Add contextual validation support via context.Context ( #296 )
...
* Add contextual validation support via context.Context
Added:
- RegisterValidationCtx
- RegisterStructValidationCtx
- StructCtx
- StructFilteredCtx
- StructPartialCtx
- StructExceptCtx
- VarCtx
- VarWithValueCtx
8 years ago
Dean Karn
fb68f39656
Add Access to Field Name from FieldLevel ( #284 )
8 years ago
Dean Karn
4bd1935852
Updated README
...
- Corrected some typos in README which Fixes #273
- Updated Benchmarks for Go 1.8
- updated lint issue in one of the tests
8 years ago
Dean Karn
b250b44763
Update test & benchmarks
...
- Updated failing test for new translation error message.
- Updated benchmarks with new machine at the same time.
8 years ago
Dean Karn
077c3830f3
Correct Namespace when array or map of structs
...
namespace was incorrect when array or map of structs, see #266
8 years ago
Dean Karn
49fccadad1
correct structonly functionality
...
- structonly wasn’t behaving correctly when not used with an accompanying struct validation.
8 years ago
Dean Karn
4d76b0dd81
Add alphaunicode & aplhanumericunicode
...
- added unicode variants of alpha & alphanumeric
8 years ago
Dean Karn
493dfb6209
correct required tag functionality for pointers, now works like old `exists` tag.
8 years ago
Dean Karn
506cc5da56
Add Filter logic
8 years ago
Jawher Moussa
73e8e76de2
Fix universal translator imports so that goimports doesn't get remove them
...
Running goimports on the codebase deletes all the imports of "github.com/go-playground/universal-translator".
The fix consists of explicitly qualifying the import statements with ut.
8 years ago
Dean Karn
cddc415625
perf enhancements + corrected issue with or's
...
- or's weren't reporting the param back in the tag, long standing but noticed issue.
- added validation check for or's when more validations exist after the or.
8 years ago
Dean Karn
532878b008
initial translation/custom error code
8 years ago
joeybloggs
6765805f88
continuing perf optimizations
9 years ago
joeybloggs
01925e342a
regain 100% test coverage
9 years ago
joeybloggs
98dee40973
perf updates all around!
9 years ago
joeybloggs
8c60a612c5
code coverage back to 100% + some code cleanup
9 years ago
joeybloggs
2fe87f7a8d
better error message.
9 years ago
joeybloggs
5d28ac67f7
remove validatable logic as it does't really work, both with clarity and pointer vs non-pointer receivers
9 years ago
joeybloggs
1ff58be284
finish conversion of test + some fixes.
9 years ago
joeybloggs
3bf69e2bbd
converting tests
9 years ago
joeybloggs
7e731afde9
field name updates
9 years ago
joeybloggs
e0e1af6a61
working instance
9 years ago
joeybloggs
77f59a0ea0
corrected some spelling mistakes in documentation
9 years ago
joeybloggs
89d5a94084
final touches + README updates
...
fresh test of old vs new benchmarks
```go
benchmark old ns/op new ns/op delta
BenchmarkFieldSuccess-8 155 118 -23.87%
BenchmarkFieldFailure-8 777 758 -2.45%
BenchmarkFieldDiveSuccess-8 2813 2471 -12.16%
BenchmarkFieldDiveFailure-8 3544 3172 -10.50%
BenchmarkFieldCustomTypeSuccess-8 328 300 -8.54%
BenchmarkFieldCustomTypeFailure-8 748 775 +3.61%
BenchmarkFieldOrTagSuccess-8 1169 1122 -4.02%
BenchmarkFieldOrTagFailure-8 1205 1167 -3.15%
BenchmarkStructLevelValidationSuccess-8 670 548 -18.21%
BenchmarkStructLevelValidationFailure-8 1380 558 -59.57%
BenchmarkStructSimpleCustomTypeSuccess-8 889 623 -29.92%
BenchmarkStructSimpleCustomTypeFailure-8 1536 1381 -10.09%
BenchmarkStructPartialSuccess-8 1194 1036 -13.23%
BenchmarkStructPartialFailure-8 1869 1734 -7.22%
BenchmarkStructExceptSuccess-8 949 888 -6.43%
BenchmarkStructExceptFailure-8 1181 1036 -12.28%
BenchmarkStructSimpleCrossFieldSuccess-8 948 773 -18.46%
BenchmarkStructSimpleCrossFieldFailure-8 1708 1487 -12.94%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 1608 1261 -21.58%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 2320 2055 -11.42%
BenchmarkStructSimpleSuccess-8 833 519 -37.70%
BenchmarkStructSimpleFailure-8 1612 1429 -11.35%
BenchmarkStructSimpleSuccessParallel-8 239 146 -38.91%
BenchmarkStructSimpleFailureParallel-8 664 551 -17.02%
BenchmarkStructComplexSuccess-8 5025 3269 -34.95%
BenchmarkStructComplexFailure-8 10166 8436 -17.02%
BenchmarkStructComplexSuccessParallel-8 1591 1024 -35.64%
BenchmarkStructComplexFailureParallel-8 4306 3536 -17.88%
benchmark old allocs new allocs delta
BenchmarkFieldSuccess-8 0 0 +0.00%
BenchmarkFieldFailure-8 4 4 +0.00%
BenchmarkFieldDiveSuccess-8 27 28 +3.70%
BenchmarkFieldDiveFailure-8 31 32 +3.23%
BenchmarkFieldCustomTypeSuccess-8 2 2 +0.00%
BenchmarkFieldCustomTypeFailure-8 4 4 +0.00%
BenchmarkFieldOrTagSuccess-8 1 1 +0.00%
BenchmarkFieldOrTagFailure-8 6 6 +0.00%
BenchmarkStructLevelValidationSuccess-8 6 5 -16.67%
BenchmarkStructLevelValidationFailure-8 11 5 -54.55%
BenchmarkStructSimpleCustomTypeSuccess-8 5 3 -40.00%
BenchmarkStructSimpleCustomTypeFailure-8 11 9 -18.18%
BenchmarkStructPartialSuccess-8 10 9 -10.00%
BenchmarkStructPartialFailure-8 15 14 -6.67%
BenchmarkStructExceptSuccess-8 7 7 +0.00%
BenchmarkStructExceptFailure-8 10 9 -10.00%
BenchmarkStructSimpleCrossFieldSuccess-8 6 4 -33.33%
BenchmarkStructSimpleCrossFieldFailure-8 11 9 -18.18%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 10 7 -30.00%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 15 12 -20.00%
BenchmarkStructSimpleSuccess-8 3 1 -66.67%
BenchmarkStructSimpleFailure-8 11 9 -18.18%
BenchmarkStructSimpleSuccessParallel-8 3 1 -66.67%
BenchmarkStructSimpleFailureParallel-8 11 9 -18.18%
BenchmarkStructComplexSuccess-8 32 15 -53.12%
BenchmarkStructComplexFailure-8 77 60 -22.08%
BenchmarkStructComplexSuccessParallel-8 32 15 -53.12%
BenchmarkStructComplexFailureParallel-8 77 60 -22.08%
benchmark old bytes new bytes delta
BenchmarkFieldSuccess-8 0 0 +0.00%
BenchmarkFieldFailure-8 432 432 +0.00%
BenchmarkFieldDiveSuccess-8 384 464 +20.83%
BenchmarkFieldDiveFailure-8 816 896 +9.80%
BenchmarkFieldCustomTypeSuccess-8 32 32 +0.00%
BenchmarkFieldCustomTypeFailure-8 432 432 +0.00%
BenchmarkFieldOrTagSuccess-8 4 4 +0.00%
BenchmarkFieldOrTagFailure-8 448 448 +0.00%
BenchmarkStructLevelValidationSuccess-8 168 160 -4.76%
BenchmarkStructLevelValidationFailure-8 632 160 -74.68%
BenchmarkStructSimpleCustomTypeSuccess-8 56 36 -35.71%
BenchmarkStructSimpleCustomTypeFailure-8 656 640 -2.44%
BenchmarkStructPartialSuccess-8 352 272 -22.73%
BenchmarkStructPartialFailure-8 808 730 -9.65%
BenchmarkStructExceptSuccess-8 314 250 -20.38%
BenchmarkStructExceptFailure-8 352 272 -22.73%
BenchmarkStructSimpleCrossFieldSuccess-8 96 80 -16.67%
BenchmarkStructSimpleCrossFieldFailure-8 552 536 -2.90%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 136 112 -17.65%
BenchmarkStructSimpleCrossStructCrossFieldFailure-8 600 576 -4.00%
BenchmarkStructSimpleSuccess-8 24 4 -83.33%
BenchmarkStructSimpleFailure-8 656 640 -2.44%
BenchmarkStructSimpleSuccessParallel-8 24 4 -83.33%
BenchmarkStructSimpleFailureParallel-8 656 640 -2.44%
BenchmarkStructComplexSuccess-8 392 244 -37.76%
BenchmarkStructComplexFailure-8 3745 3609 -3.63%
BenchmarkStructComplexSuccessParallel-8 392 244 -37.76%
BenchmarkStructComplexFailureParallel-8 3745 3609 -3.63%
```
9 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
9 years ago
joeybloggs
330b12dacd
Phase 1 optimization complete, Phase 2 ( Warm liquid goo phase ) commencing
...
Still looking good
```
benchmark old ns/op new ns/op delta
BenchmarkFieldSuccess-4 167 119 -28.74%
BenchmarkFieldFailure-4 701 653 -6.85%
BenchmarkFieldDiveSuccess-4 2937 2488 -15.29%
BenchmarkFieldDiveFailure-4 3536 3059 -13.49%
BenchmarkFieldCustomTypeSuccess-4 341 292 -14.37%
BenchmarkFieldCustomTypeFailure-4 679 679 +0.00%
BenchmarkFieldOrTagSuccess-4 1157 1146 -0.95%
BenchmarkFieldOrTagFailure-4 1109 1063 -4.15%
BenchmarkStructLevelValidationSuccess-4 694 559 -19.45%
BenchmarkStructLevelValidationFailure-4 1311 551 -57.97%
BenchmarkStructSimpleCustomTypeSuccess-4 894 641 -28.30%
BenchmarkStructSimpleCustomTypeFailure-4 1496 1302 -12.97%
BenchmarkStructPartialSuccess-4 1229 1071 -12.86%
BenchmarkStructPartialFailure-4 1838 1685 -8.32%
BenchmarkStructExceptSuccess-4 961 927 -3.54%
BenchmarkStructExceptFailure-4 1218 1068 -12.32%
BenchmarkStructSimpleCrossFieldSuccess-4 954 779 -18.34%
BenchmarkStructSimpleCrossFieldFailure-4 1569 1405 -10.45%
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4 1588 1299 -18.20%
BenchmarkStructSimpleCrossStructCrossFieldFailure-4 2217 1917 -13.53%
BenchmarkStructSimpleSuccess-4 925 519 -43.89%
BenchmarkStructSimpleFailure-4 1650 1323 -19.82%
BenchmarkStructSimpleSuccessParallel-4 261 149 -42.91%
BenchmarkStructSimpleFailureParallel-4 758 543 -28.36%
BenchmarkStructComplexSuccess-4 5868 3387 -42.28%
BenchmarkStructComplexFailure-4 10767 8498 -21.07%
BenchmarkStructComplexSuccessParallel-4 1559 1114 -28.54%
BenchmarkStructComplexFailureParallel-4 3747 3163 -15.59%
```
9 years ago
joeybloggs
c0a414dc9e
initial un-refined new caching system
9 years ago
joeybloggs
cdfcf16a86
fix some minor listing.
9 years ago
joeybloggs
93bb347253
Update validations for "url" and "uri" because of Go 1.6 changes
...
added checks for blank and fragment/suffix because of Go 1.6 change 617c93ce74 (diff-6c2d018290e298803c0c9419d8739885L195)
fix was to emulate browser and strip the '#' suffix prior to validation. see #237
9 years ago
Kevin Seidel
851787be1b
Add unicode email tests
9 years ago
joeybloggs
bf5ac690d6
Add a couple more test cases
9 years ago
joeybloggs
4cb9152af0
correct IsUPDAddrResolvable functions
9 years ago
joeybloggs
faf40fd62f
Correct validation for TCPAddrResolvable
9 years ago
joeybloggs
7b758151c6
Add workaround for go issue
9 years ago
Hubert Krauze
ee0ce7d37e
Add test for tcp/udp/ip/unix addresses resolve
9 years ago
joeybloggs
afbcf59553
Add FieldNamespace and NameNamespace
...
* Add FieldNamespace and NameNamespace to FieldError. This allows for having the CustomName i.e. JSON namespace contained within the NameNamespace which would be very useful when using a more restful API approach.
9 years ago
joeybloggs
934bef0ce5
Add new Anonymous test to hit new code
...
* now have 100% test coverage again.
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
24c1c6819f
Add nostructlevel tag
...
* nostructlevel - Same as structonly tag except that any struct level
validations will not run.
9 years ago
joeybloggs
29403404e4
Added Helper method to Report errors from struct level.
9 years ago
joeybloggs
f1acffdfe0
Add Struct Level Validation!
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
Hubert
9ffc753204
add cidr, cidrv4 and cidrv6 validators
...
- add validate functions
- add tests
- put validators as builtin in docs
9 years ago
joeybloggs
3cef97a452
minor speed improvements
...
* added check for "-" in custom field name
9 years ago
İlker Göktuğ Öztürk
5bc0ff91f8
configurable field name support
9 years ago
joeybloggs
36c0f0aa99
Update for repo move
...
* moved from bluesuncorp org to go-playground org
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
14df416126
Update Validator instance check
...
* change for one validator instance method and message
9 years ago