test support go1.18 (#2990)

This commit is contained in:
thinkerou
2022-03-21 09:43:17 +08:00
committed by GitHub
parent 9701b651b7
commit 2bde107686
47 changed files with 214 additions and 174 deletions

View File

@ -29,21 +29,21 @@ const (
// the form POST.
type Binding interface {
Name() string
Bind(*http.Request, interface{}) error
Bind(*http.Request, any) error
}
// BindingBody adds BindBody method to Binding. BindBody is similar with Bind,
// but it reads the body from supplied bytes instead of req.Body.
type BindingBody interface {
Binding
BindBody([]byte, interface{}) error
BindBody([]byte, any) error
}
// BindingUri adds BindUri method to Binding. BindUri is similar with Bind,
// but it reads the Params.
type BindingUri interface {
Name() string
BindUri(map[string][]string, interface{}) error
BindUri(map[string][]string, any) error
}
// StructValidator is the minimal interface which needs to be implemented in
@ -57,11 +57,11 @@ type StructValidator interface {
// If the received type is a struct or pointer to a struct, the validation should be performed.
// If the struct is not valid or the validation itself fails, a descriptive error should be returned.
// Otherwise nil must be returned.
ValidateStruct(interface{}) error
ValidateStruct(any) error
// Engine returns the underlying validator engine which powers the
// StructValidator implementation.
Engine() interface{}
Engine() any
}
// Validator is the default validator which implements the StructValidator
@ -110,7 +110,7 @@ func Default(method, contentType string) Binding {
}
}
func validate(obj interface{}) error {
func validate(obj any) error {
if Validator == nil {
return nil
}