[UPDATE] interface name conversion

This commit is contained in:
wuhuizuo 2019-12-26 10:12:57 +08:00 committed by wuhuizuo
parent e76518fde0
commit 7d26c24b22
2 changed files with 4 additions and 4 deletions

View File

@ -45,11 +45,11 @@ type BindingUri interface {
BindUri(map[string][]string, interface{}) error
}
// ValidatorImp is the minimal interface which needs to be implemented in
// Validater 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.
type ValidatorImp interface {
type Validater interface {
// Validate 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.
// If the received type is a struct or pointer to a struct, the validation should be performed.
@ -65,7 +65,7 @@ type ValidatorImp interface {
// Validator is the default validator which implements the StructValidator
// interface. It uses https://github.com/go-playground/validator/tree/v8.18.2
// under the hood.
var Validator ValidatorImp = &defaultValidator{}
var Validator Validater = &defaultValidator{}
// These implement the Binding interface and can be used to bind the data
// present in the request to struct instances.

View File

@ -32,7 +32,7 @@ func (err sliceValidateError) Error() string {
return strings.Join(errMsgs, "\n")
}
var _ ValidatorImp = &defaultValidator{}
var _ Validater = &defaultValidator{}
// ValidateStruct receives any kind of type, but only performed struct or pointer to struct type.
func (v *defaultValidator) Validate(obj interface{}) error {