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 ManyResponsePaginated
- type Response
- 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)
func (ErrResponse) HasErrorField ¶ added in v0.19.0
func (e ErrResponse) HasErrorField(errorField string) bool
func (ErrResponse) HasErrorFields ¶ added in v0.19.0
func (e ErrResponse) HasErrorFields(errorFields []string) bool
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 Response ¶ added in v0.20.0
type Response[T any] struct { Data T `json:"data"` }
func NewResponse ¶ added in v0.20.0
func NewResponseCreated ¶ added in v0.20.0
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.