query.go 306 B

12345678910111213141516171819
  1. package binding
  2. import (
  3. "net/http"
  4. )
  5. type queryBinding struct{}
  6. func (queryBinding) Name() string {
  7. return "query"
  8. }
  9. func (queryBinding) Bind(req *http.Request, obj interface{}) error {
  10. values := req.URL.Query()
  11. if err := mapForm(obj, values); err != nil {
  12. return err
  13. }
  14. return validate(obj)
  15. }