Documentation
¶
Index ¶
- func BoolFromQuery(r *http.Request, param string) (bool, error)
- func DecodeJSON(r *http.Request, data interface{}) error
- func EncodeJSON(w http.ResponseWriter, data interface{}) error
- func IntFromQuery[T ~int | int32 | int64](r *http.Request, param string) (T, error)
- func RenderError(w http.ResponseWriter, err error, status int)
- func UUIDFromURL(r *http.Request, w http.ResponseWriter, paramName string) uuid.UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolFromQuery ¶
BoolFromQuery extracts a query string value and converts it to a bool
func DecodeJSON ¶
DecodeJSON decodes a JSON request body into the provided data struct.
func EncodeJSON ¶
func EncodeJSON(w http.ResponseWriter, data interface{}) error
EncodeJSON encodes data into JSON and writes it to the response writer.
func IntFromQuery ¶
IntFromQuery extracts a query string value and converts it to an int if it is not empty. If the value is empty, it returns 0.
func RenderError ¶
func RenderError(w http.ResponseWriter, err error, status int)
RenderError renders an error response.
func UUIDFromURL ¶
UUIDFromURL parses a UUID from a Path parameter. If the UUID is invalid, an error is rendered and uuid.Nil is returned.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.