Documentation
¶
Index ¶
- func Bind(r *http.Request, obj interface{}) error
- func BindJSON(r *http.Request, obj interface{}) error
- func BindQuery(r *http.Request, obj interface{}) error
- func BindUri(r *http.Request, obj interface{}) error
- func BindXML(r *http.Request, obj interface{}) error
- func BindYAML(r *http.Request, obj interface{}) error
- func Error(err error) string
- func GetToken(r *http.Request) string
- func MustBindWith(r *http.Request, obj interface{}, b binding.Binding) error
- func ShouldBind(r *http.Request, obj interface{}) error
- func ShouldBindJSON(r *http.Request, obj interface{}) error
- func ShouldBindQuery(r *http.Request, obj interface{}) error
- func ShouldBindUri(r *http.Request, obj interface{}) error
- func ShouldBindWith(r *http.Request, obj interface{}, b binding.Binding) error
- func ShouldBindXML(r *http.Request, obj interface{}) error
- func ShouldBindYAML(r *http.Request, obj interface{}) error
- type RequestAt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindUri ¶
MustBindWith binds the passed struct pointer using the specified binding engine. BindUri binds the passed struct pointer using binding.Uri. It will abort the request with HTTP 400 if any error occurs.
func MustBindWith ¶
MustBindWith binds the passed struct pointer using the specified binding engine. It will abort the request with HTTP 400 if any error occurs. See the binding package.
func ShouldBind ¶
ShouldBind checks the Content-Type to select a binding engine automatically, Depending the "Content-Type" header different bindings are used:
"application/json" --> JSON binding "application/xml" --> XML binding
otherwise --> returns an error It parses the request's body as JSON if Content-Type == "application/json" using JSON or XML as a JSON input. It decodes the json payload into the struct specified as a pointer. Like c.GinBind() but this method does not set the response status code to 400 and abort if the json is not valid.
func ShouldBindJSON ¶
ShouldBindJSON is a shortcut for c.ShouldBindWith(obj, binding.JSON).
func ShouldBindQuery ¶
ShouldBindQuery is a shortcut for c.ShouldBindWith(obj, binding.Query).
func ShouldBindUri ¶
ShouldBindUri binds the passed struct pointer using the specified binding engine.
func ShouldBindWith ¶
ShouldBindWith binds the passed struct pointer using the specified binding engine. See the binding package.
func ShouldBindXML ¶
ShouldBindXML is a shortcut for c.ShouldBindWith(obj, binding.XML).
func ShouldBindYAML ¶
ShouldBindYAML is a shortcut for c.ShouldBindWith(obj, binding.YAML).