19 lines
306 B
19 lines
306 B
package binding
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
type queryBinding struct{}
|
|
|
|
func (queryBinding) Name() string {
|
|
return "query"
|
|
}
|
|
|
|
func (queryBinding) Bind(req *http.Request, obj interface{}) error {
|
|
values := req.URL.Query()
|
|
if err := mapForm(obj, values); err != nil {
|
|
return err
|
|
}
|
|
return validate(obj)
|
|
}
|
|
|