Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BindUnmarshaler ¶
type BindUnmarshaler interface { // Unmarshal decodes the argument param and assigns to itself. UnmarshalBind(param string) error }
BindUnmarshaler is the interface used to wrap the UnmarshalParam method.
type Binder ¶
type Binder interface { // Bind parses the data from http.Request to v. // // Notice: v must be a non-nil pointer. Bind(req *http.Request, v interface{}) error }
Binder is the interface to bind the value to v from ctx.
func BinderFunc ¶
BinderFunc converts a function to Binder.
func FormBinder ¶
FormBinder returns a Form binder to bind the Form request.
Notice: The bound value must be a pointer to a struct. You can modify the name of the field by the tag, which is "form" by default.
func JSONBinder ¶
func JSONBinder() Binder
JSONBinder returns a JSON binder to bind the JSON request.
func QueryBinder ¶
QueryBinder returns a query binder to bind the query parameters..
Notice: The bound value must be a pointer to a struct. You can modify the name of the field by the tag, which is "query" by default.
type MuxBinder ¶
type MuxBinder struct {
// contains filtered or unexported fields
}
MuxBinder is a multiplexer for kinds of Binders based on the Content-Type.
func (*MuxBinder) Bind ¶
Bind implements the interface Binder, which will call the registered binder to bind the request to v by the request header Content-Type.