mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 14:52:18 +08:00
[UPDATE] interface name conversion
This commit is contained in:
parent
e76518fde0
commit
7d26c24b22
@ -45,11 +45,11 @@ type BindingUri interface {
|
|||||||
BindUri(map[string][]string, interface{}) error
|
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
|
// 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
|
// of the request. Gin provides a default implementation for this using
|
||||||
// https://github.com/go-playground/validator/tree/v8.18.2.
|
// 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.
|
// 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 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.
|
// 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
|
// 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://github.com/go-playground/validator/tree/v8.18.2
|
||||||
// under the hood.
|
// under the hood.
|
||||||
var Validator ValidatorImp = &defaultValidator{}
|
var Validator Validater = &defaultValidator{}
|
||||||
|
|
||||||
// These implement the Binding interface and can be used to bind the data
|
// These implement the Binding interface and can be used to bind the data
|
||||||
// present in the request to struct instances.
|
// present in the request to struct instances.
|
||||||
|
@ -32,7 +32,7 @@ func (err sliceValidateError) Error() string {
|
|||||||
return strings.Join(errMsgs, "\n")
|
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.
|
// ValidateStruct receives any kind of type, but only performed struct or pointer to struct type.
|
||||||
func (v *defaultValidator) Validate(obj interface{}) error {
|
func (v *defaultValidator) Validate(obj interface{}) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user