Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicResponse ¶
type BasicResponse struct { Code int `json:"code" example:"500"` // HTTP status code. Message string `json:"message" example:"internal_server_error"` // Message corresponding to the status code. Error string `json:"error" example:"{$err}"` // error message. Data interface{} `json:"data,omitempty"` }
BasicResponse represents a failed response structure for API responses.
func BasicBuilder ¶
func BasicBuilder(result BasicResponse) BasicResponse
BasicBuilder constructs a BasicBuilder based on the provided error.
func (BasicResponse) Send ¶
func (c BasicResponse) Send(ctx echo.Context) error
Send sends the CustomResponse as a JSON response using the provided Echo context.
type FailedResponse ¶
type FailedResponse struct { Code int `json:"code" example:"500"` // HTTP status code. Message constants.ResponseMessage `json:"message" example:"internal_server_error"` // Message corresponding to the status code. Error string `json:"error" example:"{$err}"` // error message. }
FailedResponse represents a failed response structure for API responses.
func ErrorBuilder ¶
func ErrorBuilder(err error) FailedResponse
ErrorBuilder constructs a FailedResponse based on the provided error.
func (FailedResponse) Send ¶
func (x FailedResponse) Send(c echo.Context) error
Send sends the CustomResponse as a JSON response using the provided Echo context.
type Meta ¶
type Meta struct { Meta interface{} `json:"meta,omitempty"` //pagination payload. Success }
type ResponseFormat ¶
type ResponseFormat struct { Code int `json:"code" example:"200"` // HTTP status code. Message constants.ResponseMessage `json:"message" example:"success"` }
type Success ¶
type Success struct { ResponseFormat Data interface{} `json:"data,omitempty"` // data payload. }
type SuccessResponse ¶
SuccessResponse represents a success response structure for API responses.
func SuccessBuilder ¶
func SuccessBuilder(response interface{}, meta ...interface{}) SuccessResponse
SuccessBuilder constructs a CustomResponse with a Success status and the provided response data.
func SuccessNoResponseBuilder ¶
func SuccessNoResponseBuilder() SuccessResponse
func (SuccessResponse) Send ¶
func (c SuccessResponse) Send(ctx echo.Context) error
Send sends the CustomResponse as a JSON response using the provided Echo context.