修改包路径
This commit is contained in:
parent
63bddbcc46
commit
b36b5bda5d
|
@ -1,8 +1,8 @@
|
|||
package b
|
||||
|
||||
import (
|
||||
"gin-valid/gin/binding"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/gin/binding"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
"mime"
|
||||
"net/http"
|
||||
)
|
||||
|
|
|
@ -48,7 +48,7 @@ type BindingUri interface {
|
|||
// StructValidator is the minimal interface which needs to be implemented in
|
||||
// order for it to be used as the validator engine for ensuring the correctness
|
||||
// of the request. Gin provides a default implementation for this using
|
||||
// https://github.com/go-playground/validator/tree/v8.18.2.
|
||||
// https://git.ningdatech.com/ningda/gin_valid/go-playground/validator/tree/v8.18.2.
|
||||
type StructValidator interface {
|
||||
// ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.
|
||||
// If the received type is not a struct, any validation should be skipped and nil must be returned.
|
||||
|
@ -63,7 +63,7 @@ type StructValidator interface {
|
|||
}
|
||||
|
||||
// Validator is the default validator which implements the StructValidator
|
||||
// interface. It uses https://github.com/go-playground/validator/tree/v8.18.2
|
||||
// interface. It uses https://git.ningdatech.com/ningda/gin_valid/go-playground/validator/tree/v8.18.2
|
||||
// under the hood.
|
||||
var Validator StructValidator = &defaultValidator{}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ type BindingUri interface {
|
|||
// StructValidator is the minimal interface which needs to be implemented in
|
||||
// order for it to be used as the validator engine for ensuring the correctness
|
||||
// of the request. Gin provides a default implementation for this using
|
||||
// https://github.com/go-playground/validator/tree/v8.18.2.
|
||||
// https://git.ningdatech.com/ningda/gin_valid/go-playground/validator/tree/v8.18.2.
|
||||
type StructValidator interface {
|
||||
// ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.
|
||||
// If the received type is not a struct, any validation should be skipped and nil must be returned.
|
||||
|
@ -61,7 +61,7 @@ type StructValidator interface {
|
|||
}
|
||||
|
||||
// Validator is the default validator which implements the StructValidator
|
||||
// interface. It uses https://github.com/go-playground/validator/tree/v8.18.2
|
||||
// interface. It uses https://git.ningdatech.com/ningda/gin_valid/go-playground/validator/tree/v8.18.2
|
||||
// under the hood.
|
||||
var Validator StructValidator = &defaultValidator{}
|
||||
|
||||
|
|
|
@ -5,15 +5,14 @@
|
|||
package binding
|
||||
|
||||
import (
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
zhTrans "go-playground/validator/v10/translations/zh"
|
||||
"go-playground/locales/zh"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/zh"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
zhTrans "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10/translations/zh"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type defaultValidator struct {
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/gin/internal/bytesconv"
|
||||
"gin-valid/gin/internal/json"
|
||||
"git.ningdatech.com/ningda/gin_valid/gin/internal/bytesconv"
|
||||
"git.ningdatech.com/ningda/gin_valid/gin/internal/json"
|
||||
)
|
||||
|
||||
var errUnknownType = errors.New("unknown type")
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
|
||||
"gin-valid/gin/internal/json"
|
||||
"git.ningdatech.com/ningda/gin_valid/gin/internal/json"
|
||||
)
|
||||
|
||||
// EnableDecoderUseNumber is used to call the UseNumber method on the JSON
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/ Copyright 2019 Gin Core Team. All rights reserved.
|
||||
// Copyright 2019 Gin Core Team. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
## locales
|
||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/locales/master/logo.png">![Project status](https://img.shields.io/badge/version-0.13.0-green.svg)
|
||||
[![Build Status](https://travis-ci.org/go-playground/locales.svg?branch=master)](https://travis-ci.org/go-playground/locales)
|
||||
[![Go Report Card](https://goreportcard.com/badge/go-playground/locales)](https://goreportcard.com/report/go-playground/locales)
|
||||
[![GoDoc](https://godoc.org/go-playground/locales?status.svg)](https://godoc.org/go-playground/locales)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/locales)](https://goreportcard.com/report/github.com/go-playground/locales)
|
||||
[![GoDoc](https://godoc.org/github.com/go-playground/locales?status.svg)](https://godoc.org/github.com/go-playground/locales)
|
||||
![License](https://img.shields.io/dub/l/vibe-d.svg)
|
||||
[![Gitter](https://badges.gitter.im/go-playground/locales.svg)](https://gitter.im/go-playground/locales?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
|
@ -21,7 +21,7 @@ Features
|
|||
Full Tests
|
||||
--------------------
|
||||
I could sure use your help adding tests for every locale, it is a huge undertaking and I just don't have the free time to do it all at the moment;
|
||||
any help would be **greatly appreciated!!!!** please see [issue](https://go-playground/locales/issues/1) for details.
|
||||
any help would be **greatly appreciated!!!!** please see [issue](https://github.com/go-playground/locales/issues/1) for details.
|
||||
|
||||
Installation
|
||||
-----------
|
||||
|
@ -29,7 +29,7 @@ Installation
|
|||
Use go get
|
||||
|
||||
```shell
|
||||
go get go-playground/locales
|
||||
go get github.com/go-playground/locales
|
||||
```
|
||||
|
||||
NOTES
|
||||
|
@ -46,8 +46,8 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"go-playground/locales/currency"
|
||||
"go-playground/locales/en_CA"
|
||||
"github.com/go-playground/locales/currency"
|
||||
"github.com/go-playground/locales/en_CA"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module git.ningdatech.com/ningda/gin_valid/go-playground/locales
|
||||
|
||||
go 1.13
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"go-playground/locales/currency"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/currency"
|
||||
)
|
||||
|
||||
// // ErrBadNumberValue is returned when the number passed for
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"go-playground/locales"
|
||||
"go-playground/locales/currency"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/currency"
|
||||
)
|
||||
|
||||
type zh struct {
|
||||
|
|
|
@ -12,8 +12,8 @@ Universal Translator is an i18n Translator for Go/Golang using CLDR data + plura
|
|||
Why another i18n library?
|
||||
--------------------------
|
||||
Because none of the plural rules seem to be correct out there, including the previous implementation of this package,
|
||||
so I took it upon myself to create [locales](https://go-playground/locales) for everyone to use; this package
|
||||
is a thin wrapper around [locales](https://go-playground/locales) in order to store and translate text for
|
||||
so I took it upon myself to create [locales](https://github.com/go-playground/locales) for everyone to use; this package
|
||||
is a thin wrapper around [locales](https://github.com/go-playground/locales) in order to store and translate text for
|
||||
use in your applications.
|
||||
|
||||
Features
|
||||
|
@ -27,7 +27,7 @@ Features
|
|||
- [x] Support loading translations from files
|
||||
- [x] Exporting translations to file(s), mainly for getting them professionally translated
|
||||
- [ ] Code Generation for translation files -> Go code.. i.e. after it has been professionally translated
|
||||
- [ ] Tests for all languages, I need help with this, please see [here](https://go-playground/locales/issues/1)
|
||||
- [ ] Tests for all languages, I need help with this, please see [here](https://github.com/go-playground/locales/issues/1)
|
||||
|
||||
Installation
|
||||
-----------
|
||||
|
@ -82,7 +82,7 @@ NOTE: not all fields are needed for all translation types, see [examples](https:
|
|||
Help With Tests
|
||||
---------------
|
||||
To anyone interesting in helping or contributing, I sure could use some help creating tests for each language.
|
||||
Please see issue [here](https://go-playground/locales/issues/1) for details.
|
||||
Please see issue [here](https://github.com/go-playground/locales/issues/1) for details.
|
||||
|
||||
License
|
||||
------
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator
|
||||
|
||||
go 1.13
|
||||
|
||||
require git.ningdatech.com/ningda/gin_valid v0.0.0-20201127152634-63bddbcc4667 // indirect
|
|
@ -1,4 +1,49 @@
|
|||
go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
git.ningdatech.com/ningda/gin_valid v0.0.0-20201127152634-63bddbcc4667 h1:Twp9fEdYNlRYDmPqwGM5FcY4r7hZpMzI6/SFoYdkAjs=
|
||||
git.ningdatech.com/ningda/gin_valid v0.0.0-20201127152634-63bddbcc4667/go.mod h1:QwiarqFkyNmqYlSsUP2RrqsDtSuDncK1KGCvjgh+blQ=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/ugorji/go v1.2.0/go.mod h1:1ny++pKMXhLWrwWV5Nf+CbOuZJhMoaFD+0GMFfd8fEc=
|
||||
github.com/ugorji/go/codec v1.2.0/go.mod h1:dXvG35r7zTX6QImXOSFhGMmKtX+wJ7VTWzGvYQGIjBs=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"io"
|
||||
|
||||
"go-playground/locales"
|
||||
"github.com/go-playground/locales"
|
||||
)
|
||||
|
||||
type translation struct {
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
"github.com/go-playground/locales"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -3,7 +3,7 @@ package ut
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"go-playground/locales"
|
||||
"github.com/go-playground/locales"
|
||||
)
|
||||
|
||||
// UniversalTranslator holds all locale & translation data
|
||||
|
|
|
@ -5,7 +5,7 @@ Package validator
|
|||
[![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator)
|
||||
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||
[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://pkg.go.dev/gin-valid/go-playground/validator/v10)
|
||||
[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://pkg.go.dev/github.com/go-playground/validator/v10)
|
||||
![License](https://img.shields.io/dub/l/vibe-d.svg)
|
||||
|
||||
Package validator implements value validations for structs and individual fields based on tags.
|
||||
|
@ -27,11 +27,11 @@ Installation
|
|||
|
||||
Use go get.
|
||||
|
||||
go get gin-valid/go-playground/validator/v10
|
||||
go get github.com/go-playground/validator/v10
|
||||
|
||||
Then import the validator package into your own code.
|
||||
|
||||
import "gin-valid/go-playground/validator/v10"
|
||||
import "github.com/go-playground/validator/v10"
|
||||
|
||||
Error Return Value
|
||||
-------
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// MyStruct ..
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// DbBackedUser User struct
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// Test ...
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
import "gin-valid/gin/binding"
|
||||
import "github.com/gin-gonic/gin/binding"
|
||||
|
||||
func main() {
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"reflect"
|
||||
"sync"
|
||||
|
||||
"gin-valid/gin/binding"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type defaultValidator struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
|
|
|
@ -3,10 +3,10 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"gin-valid/go-playground/locales/en"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
en_translations "gin-valid/go-playground/validator/v10/translations/en"
|
||||
"github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
en_translations "github.com/go-playground/validator/v10/translations/en"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
module git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
git.ningdatech.com/ningda/gin_valid v0.0.0-20201127152634-63bddbcc4667 // indirect
|
||||
github.com/gin-gonic/gin v1.6.3 // indirect
|
||||
github.com/go-playground/validator/v10 v10.4.1 // indirect
|
||||
github.com/leodido/go-urn v1.2.0 // indirect
|
||||
)
|
|
@ -1,20 +1,37 @@
|
|||
git.ningdatech.com/ningda/gin_valid v0.0.0-20201127152634-63bddbcc4667 h1:Twp9fEdYNlRYDmPqwGM5FcY4r7hZpMzI6/SFoYdkAjs=
|
||||
git.ningdatech.com/ningda/gin_valid v0.0.0-20201127152634-63bddbcc4667/go.mod h1:QwiarqFkyNmqYlSsUP2RrqsDtSuDncK1KGCvjgh+blQ=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/go-playground/assert v1.2.1 h1:ad06XqC+TOv0nJWnbULSlh3ehp5uLuQEojZY5Tq8RgI=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
gin-valid/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
gin-valid/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
gin-valid/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
gin-valid/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
gin-valid/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator v9.31.0+incompatible h1:UA72EPEogEnq76ehGdEDp4Mit+3FDh548oRqwVgNsHA=
|
||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
|
@ -26,23 +43,44 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go v1.2.0 h1:6eXlzYLLwZwXroJx9NyqbYcbv/d93twiOzQLDewE6qM=
|
||||
github.com/ugorji/go v1.2.0/go.mod h1:1ny++pKMXhLWrwWV5Nf+CbOuZJhMoaFD+0GMFfd8fEc=
|
||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/ugorji/go/codec v1.2.0 h1:As6RccOIlbm9wHuWYMlB30dErcI+4WiKWsYsmPkyrUw=
|
||||
github.com/ugorji/go/codec v1.2.0/go.mod h1:dXvG35r7zTX6QImXOSFhGMmKtX+wJ7VTWzGvYQGIjBs=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 h1:xYJJ3S178yv++9zXV/hnr29plCAGO9vAFG9dorqaFQc=
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// NotBlank is the validation function for validating if the current field
|
||||
|
|
|
@ -3,8 +3,8 @@ package validators
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/assert/v2"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type test struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package validator
|
||||
|
||||
import ut "gin-valid/go-playground/universal-translator"
|
||||
import ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
|
||||
// TranslationFunc is the function type used to register or override
|
||||
// custom translations
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
english "gin-valid/go-playground/locales/en"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
english "github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
spanish "gin-valid/go-playground/locales/es"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
spanish "github.com/go-playground/locales/es"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
french "gin-valid/go-playground/locales/fr"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
french "github.com/go-playground/locales/fr"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
indonesia "gin-valid/go-playground/locales/id"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
indonesia "github.com/go-playground/locales/id"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
ja_locale "gin-valid/go-playground/locales/ja"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
ja_locale "github.com/go-playground/locales/ja"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
english "gin-valid/go-playground/locales/en"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
english "github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,11 +4,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales/pt"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
"github.com/go-playground/locales/pt"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
brazilian_portuguese "gin-valid/go-playground/locales/pt_BR"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
brazilian_portuguese "github.com/go-playground/locales/pt_BR"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -6,10 +6,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
russian "gin-valid/go-playground/locales/en"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
russian "github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
turkish "gin-valid/go-playground/locales/tr"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
turkish "github.com/go-playground/locales/tr"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
zhongwen "gin-valid/go-playground/locales/zh"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
zhongwen "github.com/go-playground/locales/zh"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
zhongwen "gin-valid/go-playground/locales/zh_Hant_TW"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
"gin-valid/go-playground/validator/v10"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
zhongwen "github.com/go-playground/locales/zh_Hant_TW"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -14,11 +14,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"gin-valid/go-playground/locales/en"
|
||||
"gin-valid/go-playground/locales/fr"
|
||||
"gin-valid/go-playground/locales/nl"
|
||||
ut "gin-valid/go-playground/universal-translator"
|
||||
. "github.com/go-playground/assert/v2"
|
||||
"github.com/go-playground/locales/en"
|
||||
"github.com/go-playground/locales/fr"
|
||||
"github.com/go-playground/locales/nl"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
)
|
||||
|
||||
// NOTES:
|
||||
|
|
8
go.mod
8
go.mod
|
@ -3,13 +3,9 @@ module git.ningdatech.com/ningda/gin_valid
|
|||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/go-playground/assert/v2 v2.0.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.17.0
|
||||
github.com/golang/protobuf v1.4.3
|
||||
github.com/json-iterator/go v1.1.10
|
||||
github.com/leodido/go-urn v1.2.0
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/json-iterator/go v1.1.10 // indirect
|
||||
github.com/ugorji/go v1.2.0 // indirect
|
||||
github.com/ugorji/go/codec v1.2.0
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue