Documentation
¶
Index ¶
- func RenderErrorResponse(r *http.Request, w http.ResponseWriter, err error)
- func RenderResponse(w http.ResponseWriter, successResponse interface{}, statusCode int)
- type ErrorDetail
- type ServiceResponse
- func NewBadRequestError(message string) ServiceResponse
- func NewInternalServerError() ServiceResponse
- func NewNotFoundError() ServiceResponse
- func NewSuccessServiceResponse(data interface{}) *ServiceResponse
- func NewUnauthorizedError(message string) ServiceResponse
- func NewUnprocessableEntityError(message string) ServiceResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderErrorResponse ¶
func RenderErrorResponse(r *http.Request, w http.ResponseWriter, err error)
func RenderResponse ¶
func RenderResponse(w http.ResponseWriter, successResponse interface{}, statusCode int)
Types ¶
type ErrorDetail ¶
type ServiceResponse ¶
type ServiceResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error []ErrorDetail `json:"errors,omitempty"`
}
func NewBadRequestError ¶
func NewBadRequestError(message string) ServiceResponse
func NewInternalServerError ¶
func NewInternalServerError() ServiceResponse
func NewNotFoundError ¶
func NewNotFoundError() ServiceResponse
func NewSuccessServiceResponse ¶
func NewSuccessServiceResponse(data interface{}) *ServiceResponse
func NewUnauthorizedError ¶
func NewUnauthorizedError(message string) ServiceResponse
func NewUnprocessableEntityError ¶
func NewUnprocessableEntityError(message string) ServiceResponse
Click to show internal directories.
Click to hide internal directories.