Compare commits

...

16 Commits
master ... v6

Author SHA1 Message Date
Dean Karn 15e8444e51 Merge pull request #182 from go-playground/v6-development 9 years ago
Dean Karn 845cd90304 Merge pull request #180 from joeybloggs/v6-development 9 years ago
joeybloggs 9c2ce25ffa Merge remote-tracking branch 'upstream/v6' into v6-development 9 years ago
Dean Karn 3399dd8aa8 Merge pull request #177 from joeybloggs/v6-development 9 years ago
joeybloggs d202c6a31c changed organization from bluesuncorp to go-playground 9 years ago
Dean Karn cd7a41eb90 Merge pull request #160 from bluesuncorp/v6-development 9 years ago
Dean Karn d47dc40800 Merge pull request #159 from joeybloggs/v6-development 9 years ago
joeybloggs 4875e8713c update benchmarks for go 1.5! 9 years ago
Dean Karn a32ef92045 Merge pull request #158 from bluesuncorp/v6-development 9 years ago
Dean Karn 9a93f0165a Merge pull request #155 from ardan-bkennedy/patch-2 9 years ago
William Kennedy 81c46b4ae4 Update examples_test.go 9 years ago
Dean Karn 6df82fdf49 Merge pull request #152 from bluesuncorp/v6-development 9 years ago
Dean Karn c62ee7ccdf Merge pull request #148 from bluesuncorp/v6-development 9 years ago
Dean Karn 0cd5e89c38 Merge pull request #146 from bluesuncorp/v6-development 9 years ago
Dean Karn f8fd45620a Update README.md 9 years ago
Dean Karn a13509df8f Merge pull request #141 from bluesuncorp/v6-development 9 years ago
  1. 62
      README.md
  2. 2
      examples/custom/custom.go
  3. 2
      examples/simple/simple.go
  4. 2
      examples_test.go
  5. 2
      validator_test.go

@ -1,10 +1,10 @@
Package validator
================
[![Join the chat at https://gitter.im/bluesuncorp/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bluesuncorp/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://semaphoreci.com/api/v1/projects/ec20115f-ef1b-4c7d-9393-cc76aba74eb4/487383/badge.svg)](https://semaphoreci.com/joeybloggs/validator)
[![Coverage Status](https://coveralls.io/repos/bluesuncorp/validator/badge.svg?branch=v6)](https://coveralls.io/r/bluesuncorp/validator?branch=v6)
[![GoDoc](https://godoc.org/gopkg.in/bluesuncorp/validator.v6?status.svg)](https://godoc.org/gopkg.in/bluesuncorp/validator.v6)
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=v6)](https://coveralls.io/r/go-playground/validator?branch=v6)
[![GoDoc](https://godoc.org/gopkg.in/go-playground/validator.v6?status.svg)](https://godoc.org/gopkg.in/go-playground/validator.v6)
Package validator implements value validations for structs and individual fields based on tags.
@ -20,20 +20,20 @@ Installation
Use go get.
go get gopkg.in/bluesuncorp/validator.v6
go get gopkg.in/go-playground/validator.v6
or to update
go get -u gopkg.in/bluesuncorp/validator.v6
go get -u gopkg.in/go-playground/validator.v6
Then import the validator package into your own code.
import "gopkg.in/bluesuncorp/validator.v6"
import "gopkg.in/go-playground/validator.v6"
Usage and documentation
------
Please see http://godoc.org/gopkg.in/bluesuncorp/validator.v6 for detailed usage docs.
Please see http://godoc.org/gopkg.in/go-playground/validator.v6 for detailed usage docs.
##### Examples:
@ -44,7 +44,7 @@ package main
import (
"fmt"
"gopkg.in/bluesuncorp/validator.v6"
"gopkg.in/go-playground/validator.v6"
)
// User contains user information
@ -143,7 +143,7 @@ import (
"fmt"
"reflect"
"gopkg.in/bluesuncorp/validator.v6"
"gopkg.in/go-playground/validator.v6"
)
// DbBackedUser User struct
@ -187,33 +187,33 @@ func ValidateValuer(field reflect.Value) interface{} {
Benchmarks
------
###### Run on MacBook Pro (Retina, 15-inch, Late 2013) 2.6 GHz Intel Core i7 16 GB 1600 MHz DDR3
###### Run on MacBook Pro (Retina, 15-inch, Late 2013) 2.6 GHz Intel Core i7 16 GB 1600 MHz DDR3 using Go 1.5
NOTE: allocations for structs are up from v5, however ns/op for parallel operations are way down.
It was a decicion not to cache struct info because although it reduced allocation to v5 levels, it
hurt parallel performance too much.
```go
go test -cpu=4 -bench=. -benchmem=true
$ go test -cpu=4 -bench=. -benchmem=true
PASS
BenchmarkFieldSuccess-4 5000000 337 ns/op 16 B/op 1 allocs/op
BenchmarkFieldFailure-4 5000000 331 ns/op 16 B/op 1 allocs/op
BenchmarkFieldCustomTypeSuccess-4 3000000 497 ns/op 32 B/op 2 allocs/op
BenchmarkFieldCustomTypeFailure-4 2000000 842 ns/op 416 B/op 6 allocs/op
BenchmarkFieldOrTagSuccess-4 500000 2432 ns/op 20 B/op 2 allocs/op
BenchmarkFieldOrTagFailure-4 1000000 1323 ns/op 384 B/op 6 allocs/op
BenchmarkStructSimpleCustomTypeSuccess-4 1000000 1409 ns/op 56 B/op 5 allocs/op
BenchmarkStructSimpleCustomTypeFailure-4 1000000 1876 ns/op 577 B/op 13 allocs/op
BenchmarkStructPartialSuccess-4 1000000 1438 ns/op 384 B/op 13 allocs/op
BenchmarkStructPartialFailure-4 1000000 2040 ns/op 785 B/op 18 allocs/op
BenchmarkStructExceptSuccess-4 1000000 1000 ns/op 368 B/op 11 allocs/op
BenchmarkStructExceptFailure-4 1000000 1431 ns/op 384 B/op 13 allocs/op
BenchmarkStructSimpleSuccess-4 1000000 1375 ns/op 24 B/op 3 allocs/op
BenchmarkStructSimpleFailure-4 1000000 1893 ns/op 529 B/op 11 allocs/op
BenchmarkStructSimpleSuccessParallel-4 5000000 362 ns/op 24 B/op 3 allocs/op
BenchmarkStructSimpleFailureParallel-4 2000000 883 ns/op 529 B/op 11 allocs/op
BenchmarkStructComplexSuccess-4 200000 8237 ns/op 368 B/op 30 allocs/op
BenchmarkStructComplexFailure-4 100000 12617 ns/op 2861 B/op 72 allocs/op
BenchmarkStructComplexSuccessParallel-4 1000000 2398 ns/op 368 B/op 30 allocs/op
BenchmarkStructComplexFailureParallel-4 300000 5733 ns/op 2862 B/op 72 allocs/op
BenchmarkFieldSuccess-4 5000000 295 ns/op 16 B/op 1 allocs/op
BenchmarkFieldFailure-4 5000000 291 ns/op 16 B/op 1 allocs/op
BenchmarkFieldCustomTypeSuccess-4 3000000 437 ns/op 32 B/op 2 allocs/op
BenchmarkFieldCustomTypeFailure-4 2000000 772 ns/op 416 B/op 6 allocs/op
BenchmarkFieldOrTagSuccess-4 1000000 1302 ns/op 32 B/op 2 allocs/op
BenchmarkFieldOrTagFailure-4 1000000 1137 ns/op 400 B/op 6 allocs/op
BenchmarkStructSimpleCustomTypeSuccess-4 1000000 1190 ns/op 80 B/op 5 allocs/op
BenchmarkStructSimpleCustomTypeFailure-4 1000000 1743 ns/op 608 B/op 13 allocs/op
BenchmarkStructPartialSuccess-4 1000000 1302 ns/op 400 B/op 11 allocs/op
BenchmarkStructPartialFailure-4 1000000 1819 ns/op 784 B/op 16 allocs/op
BenchmarkStructExceptSuccess-4 2000000 876 ns/op 368 B/op 9 allocs/op
BenchmarkStructExceptFailure-4 1000000 1301 ns/op 400 B/op 11 allocs/op
BenchmarkStructSimpleSuccess-4 1000000 1117 ns/op 48 B/op 3 allocs/op
BenchmarkStructSimpleFailure-4 1000000 1721 ns/op 560 B/op 11 allocs/op
BenchmarkStructSimpleSuccessParallel-4 5000000 332 ns/op 48 B/op 3 allocs/op
BenchmarkStructSimpleFailureParallel-4 2000000 678 ns/op 560 B/op 11 allocs/op
BenchmarkStructComplexSuccess-4 200000 6687 ns/op 432 B/op 27 allocs/op
BenchmarkStructComplexFailure-4 200000 11507 ns/op 2919 B/op 69 allocs/op
BenchmarkStructComplexSuccessParallel-4 500000 2305 ns/op 432 B/op 27 allocs/op
BenchmarkStructComplexFailureParallel-4 300000 4692 ns/op 2920 B/op 69 allocs/op
```
How to Contribute

@ -6,7 +6,7 @@ import (
"fmt"
"reflect"
"gopkg.in/bluesuncorp/validator.v6"
"gopkg.in/go-playground/validator.v6"
)
// DbBackedUser User struct

@ -7,7 +7,7 @@ import (
sql "database/sql/driver"
"gopkg.in/bluesuncorp/validator.v6"
"gopkg.in/go-playground/validator.v6"
)
// User contains user information

@ -3,7 +3,7 @@ package validator_test
import (
"fmt"
"gopkg.in/bluesuncorp/validator.v6"
"gopkg.in/go-playground/validator.v6"
)
func ExampleValidate_new() {

@ -9,7 +9,7 @@ import (
"testing"
"time"
. "gopkg.in/bluesuncorp/assert.v1"
. "gopkg.in/go-playground/assert.v1"
)
// NOTES:

Loading…
Cancel
Save