Documentation ¶
Index ¶
- type Error
- type ErrorResponse
- type Resource
- func (r *Resource) Echo(ctx *gin.Context)
- func (r *Resource) EchoPure() (statusCode int, response map[string]any)
- func (r *Resource) Validation(err error) Response
- func (r *Resource) WithError(err error) Response
- func (r *Resource) WithMessage(message string, args ...map[string]interface{}) Response
- func (r *Resource) WithMeta(data interface{}) Response
- func (r *Resource) WithPayload(data any) Response
- func (r *Resource) WithStatusCode(statusCode int) Response
- type Response
- type ServiceError
- type ValidationError
- type Validations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) Validation ¶
Validation sets the validation error to be sent to the client.
func (*Resource) WithMessage ¶
WithMessage sets the message to be sent to the client.
func (*Resource) WithPayload ¶
WithPayload sets the data to be sent to the client.
func (*Resource) WithStatusCode ¶
WithStatusCode sets the status code to be sent to the client.
type Response ¶
type Response interface { Validation(err error) Response WithPayload(data any) Response WithMessage(message string, args ...map[string]interface{}) Response WithError(err error) Response WithMeta(data interface{}) Response Echo(ctx *gin.Context) EchoPure() (statusCode int, response map[string]any) WithStatusCode(statusCode int) Response }
func NewResponse ¶
func NewResponse( trans translation.Translation, statusCodeMappings ...map[string]int, ) Response
NewResponse creates a new response.
type ServiceError ¶
type ServiceError struct {
// contains filtered or unexported fields
}
func NewServiceError ¶
func NewServiceError( err error, attrs ...map[string]interface{}, ) *ServiceError
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
func (*ServiceError) GetAttributes ¶
func (e *ServiceError) GetAttributes() map[string]interface{}
func (*ServiceError) GetMessage ¶
func (e *ServiceError) GetMessage() string
func (*ServiceError) GetType ¶
func (e *ServiceError) GetType() string
func (*ServiceError) SetType ¶
func (e *ServiceError) SetType(errorType string) Error
type ValidationError ¶
type Validations ¶
Click to show internal directories.
Click to hide internal directories.