gin-valid 改为下划线
This commit is contained in:
parent
0e90ef70bd
commit
22ec4deb4a
|
@ -1,8 +1,8 @@
|
||||||
package b
|
package b
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.ningdatech.com/ningda/gin-valid/gin/binding"
|
"git.ningdatech.com/ningda/gin_valid/gin/binding"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
package binding
|
package binding
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.ningdatech.com/ningda/gin-valid/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"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
zhTrans "git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10/translations/zh"
|
zhTrans "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10/translations/zh"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/gin/internal/bytesconv"
|
"git.ningdatech.com/ningda/gin_valid/gin/internal/bytesconv"
|
||||||
"git.ningdatech.com/ningda/gin-valid/gin/internal/json"
|
"git.ningdatech.com/ningda/gin_valid/gin/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errUnknownType = errors.New("unknown type")
|
var errUnknownType = errors.New("unknown type")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/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
|
// EnableDecoderUseNumber is used to call the UseNumber method on the JSON
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales/currency"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/currency"
|
||||||
)
|
)
|
||||||
|
|
||||||
// // ErrBadNumberValue is returned when the number passed for
|
// // ErrBadNumberValue is returned when the number passed for
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales/currency"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/currency"
|
||||||
)
|
)
|
||||||
|
|
||||||
type zh struct {
|
type zh struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
)
|
)
|
||||||
|
|
||||||
type translation struct {
|
type translation struct {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ut
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UniversalTranslator holds all locale & translation data
|
// 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)
|
[![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)
|
[![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)
|
[![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/git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10)
|
[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://pkg.go.dev/git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10)
|
||||||
![License](https://img.shields.io/dub/l/vibe-d.svg)
|
![License](https://img.shields.io/dub/l/vibe-d.svg)
|
||||||
|
|
||||||
Package validator implements value validations for structs and individual fields based on tags.
|
Package validator implements value validations for structs and individual fields based on tags.
|
||||||
|
@ -27,11 +27,11 @@ Installation
|
||||||
|
|
||||||
Use go get.
|
Use go get.
|
||||||
|
|
||||||
go get git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10
|
go get git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10
|
||||||
|
|
||||||
Then import the validator package into your own code.
|
Then import the validator package into your own code.
|
||||||
|
|
||||||
import "git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
import "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
|
|
||||||
Error Return Value
|
Error Return Value
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package validators
|
package validators
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package validators
|
package validators
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
"github.com/go-playground/assert/v2"
|
"github.com/go-playground/assert/v2"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package validator
|
package validator
|
||||||
|
|
||||||
import ut "git.ningdatech.com/ningda/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
|
// TranslationFunc is the function type used to register or override
|
||||||
// custom translations
|
// custom translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/locales"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
"git.ningdatech.com/ningda/gin-valid/go-playground/validator/v10"
|
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDefaultTranslations registers a set of default translations
|
// RegisterDefaultTranslations registers a set of default translations
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
ut "git.ningdatech.com/ningda/gin-valid/go-playground/universal-translator"
|
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
Loading…
Reference in New Issue