Documentation ¶
Index ¶
- type ErrResponse
- func NewErrResponse(e error) (int, ErrResponse)
- func NewErrResponseBadRequest(message string) (int, ErrResponse)
- func NewErrResponseException(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 ManyResponsePaginated
- 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 NewErrResponseException ¶ added in v0.7.0
func NewErrResponseException(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) (int, ManyResponse[T])
type ManyResponsePaginated ¶ added in v0.7.0
type ManyResponsePaginated[T any] struct { Data []T `json:"data"` Pagination struct { Total int64 `json:"total"` } `json:"pagination"` }
func NewManyResponsePaginated ¶ added in v0.7.0
func NewManyResponsePaginated[T any](models []T, total int64) (int, ManyResponsePaginated[T])
type SingleResponse ¶
type SingleResponse[T any] struct { Data T `json:"data"` }
func NewSingleResponse ¶
func NewSingleResponse[T any](model T) (int, SingleResponse[T])
func NewSingleResponseCreated ¶ added in v0.8.0
func NewSingleResponseCreated[T any](model T) (int, 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.