gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

query.go (460B)


      1 // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
      2 // Use of this source code is governed by a MIT style
      3 // license that can be found in the LICENSE file.
      4 
      5 package binding
      6 
      7 import "net/http"
      8 
      9 type queryBinding struct{}
     10 
     11 func (queryBinding) Name() string {
     12 	return "query"
     13 }
     14 
     15 func (queryBinding) Bind(req *http.Request, obj any) error {
     16 	values := req.URL.Query()
     17 	if err := mapForm(obj, values); err != nil {
     18 		return err
     19 	}
     20 	return validate(obj)
     21 }