Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var KeyHandler key = "custom_handler"
KeyHandler custom handler
Functions ¶
func ErrorHandler ¶
ErrorHandler override echo.HTTPErrorHandler
func NewHandler ¶
func NewHandler(ctxFunc ContextFunc) echo.HandlerFunc
NewHandler generate a base handler
Types ¶
type Config ¶
Config struct
func (*Config) HealthCheck ¶
HealthCheck will enable the health_check URL
type Context ¶
Context struct
func (*Context) GetContext ¶
GetContext return request context
type HTTPError ¶
type HTTPError struct {
RequestID string `json:"request_id"`
// StatusCode is http status code
StatusCode int `json:"status_code"`
// Code is the error code
Code string `json:"code"`
// Message is the error message that may be displayed to end users
Message string `json:"error_message"`
// DeveloperMessage is the error message that is mainly meant for developers
DeveloperMessage string `json:"developer_message,omitempty"`
DeveloperTrace string `json:"developer_trace,omitempty"`
// Details specifies the additional error information
Details interface{} `json:"details"`
}
HTTPError struct
func ErrInternalServerError ¶
InternalServerError creates a new API error representing an internal server error (HTTP 500)
func ErrNotFound ¶
func ErrNotFound() *HTTPError
NotFound creates a new API error representing a resource-not-found error (HTTP 404)
func ErrUnauthorized ¶
Unauthorized creates a new API error representing an authentication failure (HTTP 401)
func ErrValidation ¶
func ErrValidation(errs validation.Errors) *HTTPError
ErrValidation converts a data validation error into an API error (HTTP 400)
type JSONResponse ¶
type JSONResponse struct {
RequestID string `json:"request_id"`
Code int `json:"status_code"`
Result interface{} `json:"data"`
}
JSONResponse struct
Click to show internal directories.
Click to hide internal directories.