Commit graph

883 commits

Author SHA1 Message Date
Kenneth Kouot
719d0b12ee Fix another typo: eq to ne 2016-06-21 17:11:27 -07:00
Kenneth Kouot
3499e730cb Fix typo: ne is validation key for not equal 2016-06-21 16:50:52 -07:00
joeybloggs
014792cf3e Update README version 2016-02-23 15:26:51 -05:00
joeybloggs
e7749ea250 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
2016-02-23 15:26:02 -05:00
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
2016-02-23 15:25:49 -05:00
Dean Karn
1214d3629c Update README.md 2016-02-18 16:51:20 -05:00
Dean Karn
bd356b6899 Merge pull request #235 from moogle19/master
Add unicode email tests
2016-02-17 10:18:01 -05:00
Kevin Seidel
851787be1b Add unicode email tests 2016-02-17 12:53:31 +01:00
joeybloggs
f38559b489 Update checking unexpected fields for Go 1.6 https://tip.golang.org/doc/go1.6#reflect
* I have not run into the issue yet, but being preemptive
2016-02-15 20:41:29 -05:00
Dean Karn
4c79e69823 Merge pull request #234 from go-playground/krhubert
Add validation functions for tcp/udp/ip/unix addresses
2016-02-02 20:01:43 -05:00
joeybloggs
bf5ac690d6 Add a couple more test cases 2016-02-02 08:37:11 -05:00
joeybloggs
6851add4e4 Update to avoid double resolves 2016-02-02 08:33:55 -05:00
joeybloggs
4cb9152af0 correct IsUPDAddrResolvable functions 2016-02-02 08:23:37 -05:00
joeybloggs
faf40fd62f Correct validation for TCPAddrResolvable 2016-02-02 08:12:47 -05:00
Dean Karn
73aaa89512 Update README.md 2016-01-29 20:36:57 -05:00
joeybloggs
7b758151c6 Add workaround for go issue 2016-01-20 10:06:30 -05:00
Hubert Krauze
3eaf857419 Add docs tcp/udp/ip/unix addresses resolve 2016-01-20 09:52:59 +01:00
Hubert Krauze
ee0ce7d37e Add test for tcp/udp/ip/unix addresses resolve 2016-01-20 09:44:06 +01:00
Hubert Krauze
312ba49f28 Remove duplicated "Usage: mac" from docs 2016-01-19 15:11:08 +01:00
Hubert Krauze
def24ae611 Add Resolvable suffix to functions so they can be more meaningful 2016-01-19 15:09:50 +01:00
Hubert Krauze
5a99cf6052 Add validation functions for tcp/udp/ip/unix addresses 2016-01-19 13:01:05 +01:00
joeybloggs
c193cecd12 Merge branch 'complimentary-software-section' into v8 2016-01-09 19:39:59 -05:00
joeybloggs
64b7e2bb79 correct CI links 2016-01-09 19:39:29 -05:00
joeybloggs
50ada8d03a Add Complimentary software section README 2016-01-09 19:28:39 -05:00
Dean Karn
d370e28d44 Merge pull request #232 from aarongreenlee/v8
Revisions to GoDoc
2016-01-09 19:10:57 -05:00
Aaron Greenlee
0b51ee1e8e Removed duplicate punctuation. 2016-01-09 13:49:43 -05:00
Aaron Greenlee
71d9b9e91c Some grammer corrections; Formatting of GoDoc 2016-01-09 13:42:12 -05:00
Aaron Greenlee
24ea3a17b5 Minor typo corrected in doc.go 2016-01-09 12:30:34 -05:00
Dean Karn
e8d470cd7a Merge pull request #229 from go-playground/v8-development
Add FieldNamespace and NameNamespace + string comparison optimizations
2016-01-06 09:33:57 -05:00
Dean Karn
b737e38edb Merge pull request #228 from joeybloggs/v8-development
Add FieldNamespace and NameNamespace + string comparison optimizations
2016-01-06 09:32:30 -05:00
joeybloggs
0862513fbf Add some string check optimizations
* was using len(string) for some blank checks instead of string == ""
2016-01-06 09:29:50 -05:00
joeybloggs
0b533f264c Only set namespace prefix when using FieldNameTag 2016-01-06 08:46:19 -05:00
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.
2016-01-06 08:44:33 -05:00
Dean Karn
bc50625289 Merge pull request #222 from go-playground/v8-development
Add validator logo
2015-12-02 17:20:47 -05:00
Dean Karn
e7cce24a67 Merge pull request #221 from muyiwaolurin/v8-development
Test Logo
2015-12-02 17:20:05 -05:00
Anthony Olurin
c4d5999ec0 Added logo to ReadMe 2015-11-30 23:37:32 -05:00
Dean Karn
43f534e655 Merge pull request #220 from go-playground/v8-development
Add new Anonymous test to hit new code
2015-11-27 20:02:09 -05:00
Dean Karn
8040a52f21 Merge pull request #219 from joeybloggs/v8-development
Add new Anonymous test to hit new code
2015-11-27 20:00:44 -05:00
joeybloggs
934bef0ce5 Add new Anonymous test to hit new code
* now have 100% test coverage again.
2015-11-27 19:58:28 -05:00
Dean Karn
0794474f60 Merge pull request #218 from go-playground/v8-development
Add struct field + associated tags caching
2015-11-27 16:03:59 -05:00
Dean Karn
589c2ad113 Merge pull request #217 from joeybloggs/v8-development
Add struct field + associated tags caching
2015-11-27 16:02:40 -05:00
joeybloggs
e019c28542 Add struct field + associated tags caching
* This essentially reduces the number of cache tag lookups for a structs fields to one.
2015-11-27 15:19:15 -05:00
joeybloggs
94182a2199 init struct cache changes 2015-11-27 10:13:49 -05:00
Dean Karn
638ea8a3f8 Merge pull request #216 from go-playground/v8-development
Micro optimization in Tag Cache
2015-11-26 08:49:18 -05:00
Dean Karn
d5987d5437 Merge pull request #215 from joeybloggs/v8-development
Micro optimization in Tag Cache
2015-11-26 08:47:46 -05:00
joeybloggs
b0bd08d7c8 Micro optimization in Tag Cache
Removed defer from the simple Tag Cache lock & unlock and reduced
execution time for even single field validation by almost 100ns
from 254ns/op to 163ns/op .. Not badd for such a simple modification
and this effect ripples throughout struct validation.

```go
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkFieldSuccess-4                            	10000000 163 ns/op	       0 B/op	       0 allocs/op
BenchmarkFieldFailure-4                            	 2000000 673 ns/op	     400 B/op	       4 allocs/op
BenchmarkFieldDiveSuccess-4                        	  500000 3019 ns/op	     480 B/op	      27 allocs/op
BenchmarkFieldDiveFailure-4                        	  500000 3553 ns/op	     880 B/op	      31 allocs/op
BenchmarkFieldCustomTypeSuccess-4                  	 5000000 347 ns/op	      32 B/op	       2 allocs/op
BenchmarkFieldCustomTypeFailure-4                  	 2000000 645 ns/op	     400 B/op	       4 allocs/op
BenchmarkFieldOrTagSuccess-4                       	 1000000 1177 ns/op	      16 B/op	       1 allocs/op
BenchmarkFieldOrTagFailure-4                       	 1000000 1093 ns/op	     432 B/op	       6 allocs/op
BenchmarkStructLevelValidationSuccess-4            	 2000000 702 ns/op	     160 B/op	       6 allocs/op
BenchmarkStructLevelValidationFailure-4            	 1000000 1279 ns/op	     592 B/op	      11 allocs/op
BenchmarkStructSimpleCustomTypeSuccess-4           	 1000000 1010 ns/op	      80 B/op	       5 allocs/op
BenchmarkStructSimpleCustomTypeFailure-4           	 1000000 1544 ns/op	     624 B/op	      11 allocs/op
BenchmarkStructPartialSuccess-4                    	 1000000 1249 ns/op	     400 B/op	      11 allocs/op
BenchmarkStructPartialFailure-4                    	 1000000 1797 ns/op	     816 B/op	      16 allocs/op
BenchmarkStructExceptSuccess-4                     	 2000000 927 ns/op	     368 B/op	       9 allocs/op
BenchmarkStructExceptFailure-4                     	 1000000 1259 ns/op	     400 B/op	      11 allocs/op
BenchmarkStructSimpleCrossFieldSuccess-4           	 1000000 1076 ns/op	     128 B/op	       6 allocs/op
BenchmarkStructSimpleCrossFieldFailure-4           	 1000000 1623 ns/op	     560 B/op	      11 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4	 1000000 1582 ns/op	     176 B/op	       9 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldFailure-4	 1000000 2139 ns/op	     608 B/op	      14 allocs/op
BenchmarkStructSimpleSuccess-4                     	 1000000 1040 ns/op	      48 B/op	       3 allocs/op
BenchmarkStructSimpleFailure-4                     	 1000000 1683 ns/op	     624 B/op	      11 allocs/op
BenchmarkStructSimpleSuccessParallel-4             	 5000000 356 ns/op	      48 B/op	       3 allocs/op
BenchmarkStructSimpleFailureParallel-4             	 2000000 831 ns/op	     624 B/op	      11 allocs/op
BenchmarkStructComplexSuccess-4                    	  200000 6738 ns/op	     512 B/op	      30 allocs/op
BenchmarkStructComplexFailure-4                    	  200000 11387 ns/op	    3415 B/op	      72 allocs/op
BenchmarkStructComplexSuccessParallel-4            	  500000 2330 ns/op	     512 B/op	      30 allocs/op
BenchmarkStructComplexFailureParallel-4            	  300000 4857 ns/op	    3416 B/op	      72 allocs/op
```

```go
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkFieldSuccess-4                            	 5000000 254 ns/op	       0 B/op	       0 allocs/op
BenchmarkFieldFailure-4                            	 2000000 779 ns/op	     400 B/op	       4 allocs/op
BenchmarkFieldDiveSuccess-4                        	  500000 3451 ns/op	     480 B/op	      27 allocs/op
BenchmarkFieldDiveFailure-4                        	  300000 3954 ns/op	     880 B/op	      31 allocs/op
BenchmarkFieldCustomTypeSuccess-4                  	 3000000 451 ns/op	      32 B/op	       2 allocs/op
BenchmarkFieldCustomTypeFailure-4                  	 2000000 751 ns/op	     400 B/op	       4 allocs/op
BenchmarkFieldOrTagSuccess-4                       	 1000000 1312 ns/op	      16 B/op	       1 allocs/op
BenchmarkFieldOrTagFailure-4                       	 1000000 1206 ns/op	     432 B/op	       6 allocs/op
BenchmarkStructLevelValidationSuccess-4            	 2000000 829 ns/op	     160 B/op	       6 allocs/op
BenchmarkStructLevelValidationFailure-4            	 1000000 1403 ns/op	     592 B/op	      11 allocs/op
BenchmarkStructSimpleCustomTypeSuccess-4           	 1000000 1238 ns/op	      80 B/op	       5 allocs/op
BenchmarkStructSimpleCustomTypeFailure-4           	 1000000 1771 ns/op	     624 B/op	      11 allocs/op
BenchmarkStructPartialSuccess-4                    	 1000000 1399 ns/op	     400 B/op	      11 allocs/op
BenchmarkStructPartialFailure-4                    	 1000000 1926 ns/op	     816 B/op	      16 allocs/op
BenchmarkStructExceptSuccess-4                     	 2000000 930 ns/op	     368 B/op	       9 allocs/op
BenchmarkStructExceptFailure-4                     	 1000000 1381 ns/op	     400 B/op	      11 allocs/op
BenchmarkStructSimpleCrossFieldSuccess-4           	 1000000 1253 ns/op	     128 B/op	       6 allocs/op
BenchmarkStructSimpleCrossFieldFailure-4           	 1000000 1849 ns/op	     560 B/op	      11 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldSuccess-4	 1000000 1902 ns/op	     176 B/op	       9 allocs/op
BenchmarkStructSimpleCrossStructCrossFieldFailure-4	  500000 2453 ns/op	     608 B/op	      14 allocs/op
BenchmarkStructSimpleSuccess-4                     	 1000000 1182 ns/op	      48 B/op	       3 allocs/op
BenchmarkStructSimpleFailure-4                     	 1000000 1842 ns/op	     624 B/op	      11 allocs/op
BenchmarkStructSimpleSuccessParallel-4             	 5000000 342 ns/op	      48 B/op	       3 allocs/op
BenchmarkStructSimpleFailureParallel-4             	 2000000 665 ns/op	     624 B/op	      11 allocs/op
BenchmarkStructComplexSuccess-4                    	  200000 7924 ns/op	     512 B/op	      30 allocs/op
BenchmarkStructComplexFailure-4                    	  100000 12605 ns/op	    3415 B/op	      72 allocs/op
BenchmarkStructComplexSuccessParallel-4            	 1000000 2421 ns/op	     512 B/op	      30 allocs/op
BenchmarkStructComplexFailureParallel-4            	  300000 4234 ns/op	    3416 B/op	      72 allocs/op
```
2015-11-26 08:37:14 -05:00
Dean Karn
ec28e2da37 Merge pull request #214 from go-playground/v8-development
Update benchmarks + correct benchmark error
2015-11-22 21:38:43 -05:00
Dean Karn
47c3cabf25 Merge pull request #213 from joeybloggs/v8-development
Update benchmarks + correct benchmark error
2015-11-22 21:37:42 -05:00
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.
2015-11-22 21:33:42 -05:00
Dean Karn
d776d3eb2e Merge pull request #212 from go-playground/v8-development
Add minor optimization for structonly & nostructlevel checks
2015-11-20 09:03:58 -05:00