feat(context): add BindQuery func (#1029)

* feat(context): add BindQuery func, only parse/bind the query string params.

* docs(readme): add BindQuery section.

* docs(readme): fix import.

* docs(readme): separate import
This commit is contained in:
Eason Lin
2017-07-19 15:50:05 +08:00
committed by Javier Provecho Fernandez
parent 74221b8a35
commit c19aa0598b
6 changed files with 109 additions and 1 deletions

View File

@ -467,6 +467,11 @@ func (c *Context) BindJSON(obj interface{}) error {
return c.MustBindWith(obj, binding.JSON)
}
// BindQuery is a shortcut for c.MustBindWith(obj, binding.Query)
func (c *Context) BindQuery(obj interface{}) error {
return c.MustBindWith(obj, binding.Query)
}
// MustBindWith binds the passed struct pointer using the specified binding
// engine. It will abort the request with HTTP 400 if any error ocurrs.
// See the binding package.