Documentation
¶
Index ¶
- func BadRequest(w http.ResponseWriter, message string)
- func InternalError(w http.ResponseWriter, logger *slog.Logger, err error)
- func ParseID(r *http.Request, key string) (int64, validation.Validator)
- func QueryInt32(r *http.Request, key string, defaultValue int32) (int32, error)
- func ReadJSON(r io.Reader, data any) error
- func UnprocessableContent(w http.ResponseWriter, messages map[string][]string)
- func WriteJSON(w http.ResponseWriter, status int, data any) error
- type ErrorResponse
- type UnprocessableErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, message string)
func InternalError ¶
func InternalError(w http.ResponseWriter, logger *slog.Logger, err error)
func UnprocessableContent ¶
func UnprocessableContent(w http.ResponseWriter, messages map[string][]string)
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type UnprocessableErrorResponse ¶
type UnprocessableErrorResponse struct {
ErrorResponse
Messages map[string][]string `json:"messages"`
}
Click to show internal directories.
Click to hide internal directories.