Documentation ¶
Index ¶
- type ErrResponse
- func NewErrResponse(e error) (int, ErrResponse)
- func NewErrResponseBadRequest(message string) (int, ErrResponse)
- func NewErrResponseForbidden(message string) (int, ErrResponse)
- func NewErrResponseNotFound(message string) (int, ErrResponse)
- func NewErrResponseValidationErrors(message string, errors map[string]string) (int, ErrResponse)
- type ManyResponse
- type SingleResponse
- type SuccessResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrResponse ¶
type ErrResponse struct { // Code is the error code Code int `json:"code"` // Message is the error message Message string `json:"message"` // Validation errors Errors map[string]string `json:"errors,omitempty"` }
ErrResponse is a generic error response
func NewErrResponse ¶
func NewErrResponse(e error) (int, ErrResponse)
func NewErrResponseBadRequest ¶
func NewErrResponseBadRequest(message string) (int, ErrResponse)
func NewErrResponseForbidden ¶
func NewErrResponseForbidden(message string) (int, ErrResponse)
func NewErrResponseNotFound ¶
func NewErrResponseNotFound(message string) (int, ErrResponse)
func NewErrResponseValidationErrors ¶
func NewErrResponseValidationErrors(message string, errors map[string]string) (int, ErrResponse)
type ManyResponse ¶
type ManyResponse[T any] struct { Data []T `json:"data"` }
func NewManyResponse ¶
func NewManyResponse[T any](models []T) ManyResponse[T]
type SingleResponse ¶
type SingleResponse[T any] struct { Data T `json:"data"` }
func NewSingleResponse ¶
func NewSingleResponse[T any](model T) SingleResponse[T]
type SuccessResponse ¶
func NewSuccessResponse ¶
func NewSuccessResponse(message string) (int, SuccessResponse)
func NewSuccessResponseCreated ¶
func NewSuccessResponseCreated(message string) (int, SuccessResponse)
Click to show internal directories.
Click to hide internal directories.