support bind uri param (#1612)
* support bind uri (1) * uri binding successful run * fix vet warning: github.com/gin-gonic/gin/internal.Param composite literal uses unkeyed fields * fix code style * update function name * fix test function signature * add test for CanSet * update readme and add test case * remove internal.Params * add coverage * fix warning
This commit is contained in:
@ -36,6 +36,13 @@ type BindingBody interface {
|
||||
BindBody([]byte, interface{}) error
|
||||
}
|
||||
|
||||
// BindingUri adds BindUri method to Binding. BindUri is similar with Bind,
|
||||
// but it read the Params.
|
||||
type BindingUri interface {
|
||||
Name() string
|
||||
BindUri(map[string][]string, interface{}) error
|
||||
}
|
||||
|
||||
// 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
|
||||
@ -70,6 +77,7 @@ var (
|
||||
ProtoBuf = protobufBinding{}
|
||||
MsgPack = msgpackBinding{}
|
||||
YAML = yamlBinding{}
|
||||
Uri = uriBinding{}
|
||||
)
|
||||
|
||||
// Default returns the appropriate Binding instance based on the HTTP method
|
||||
|
Reference in New Issue
Block a user