Documentation
¶
Index ¶
Constants ¶
View Source
const ( MIMEApplicationXML = "application/xml" MIMETextXML = "text/xml" MIMEApplicationForm = "application/x-www-form-urlencoded" MIMEMultipartForm = "multipart/form-data" MIMEApplicationJSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindUnmarshaler ¶
type RequestBinder ¶
type RequestBinder struct {
// contains filtered or unexported fields
}
func NewRequestBinder ¶
func NewRequestBinder(validator Validator) RequestBinder
func (RequestBinder) Bind ¶
func (b RequestBinder) Bind(ctx context.Context, ctype string, r *http.Request, destType reflect.Type, ) (reflect.Value, error)
*
- Bind takes the incoming HTTP request, extracts the necessary data based on the request method,
- and binds it to the provided destination type. It handles query parameters, path parameters,
- and request body binding. It also performs validation on the bound data using the validator. *
- Parameters:
- - ctx: the context of the request
- - ctype: the content type of the request body
- - r: the incoming HTTP request
- - destType: the reflect.Type of the destination object *
- Returns:
- - reflect.Value: the reflect.Value of the bound data
- - error: an error if any binding or validation fails
Click to show internal directories.
Click to hide internal directories.