Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorHandler(logger *zap.SugaredLogger) func(err error, c echo.Context)
- func IDFromContext(c echo.Context, key string) (int, error)
- func IDFromPath(c echo.Context, key string) (int, error)
- func ProcessDomainError(ctx echo.Context, err error) error
- func UserID(ctx echo.Context) (int, error)
- type BaseHandler
- type BaseSearchRequest
- type DefaultResponse
- type EmptyResponse
- type Error
- type ErrorResponse
- type ErrorValidateResponse
- type FieldError
- type Handler
- type ModelDateTime
Constants ¶
View Source
const ( ID = "id" UserId = "user_id" PropertyId = "property_id" ImageId = "image_id" )
Variables ¶
View Source
var ( ErrNotFound = New("NOT_FOUND", http.StatusNotFound) ErrExists = New("EXIST_ERROR", http.StatusBadRequest) ErrInternal = New("INTERNAL_ERROR", http.StatusInternalServerError) ErrTimeout = New("REQUEST_TIMEOUT", http.StatusRequestTimeout) ErrBind = New("COULD_NOT_PARSE_AND_BIND_REQUEST", http.StatusBadRequest) ErrMapping = New("COULD_NOT_MAP_DATA", http.StatusUnprocessableEntity) ErrValidate = New("REQUEST_VALIDATION_FAILURE", http.StatusBadRequest) ErrAccessForbidden = New("ACCESS_FORBIDDEN", http.StatusForbidden) )
Error codes Only common use codes should be in the library, implementation-specific errors should be in other packages.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(logger *zap.SugaredLogger) func(err error, c echo.Context)
func IDFromContext ¶
func IDFromPath ¶
func ProcessDomainError ¶
Types ¶
type BaseHandler ¶
type BaseHandler struct { }
func (BaseHandler) ValidateRequest ¶
func (n BaseHandler) ValidateRequest(ctx echo.Context, req interface{}) (bool, error)
type BaseSearchRequest ¶
type DefaultResponse ¶
type EmptyResponse ¶
type EmptyResponse struct {
} // @name EmptyResponse
type Error ¶
type Error struct { Err string `json:"error"` Code int `json:"-"` // contains filtered or unexported fields }
type ErrorResponse ¶
type ErrorResponse struct { Message string `json:"error,omitempty"` } // @name ErrorResponse
type ErrorValidateResponse ¶
type ErrorValidateResponse struct { Err string `json:"error"` FieldErrors []FieldError `json:"fieldErrors"` } // @name ValidationErrorResponse
func NewErrorValidateResponse ¶
func NewErrorValidateResponse(message string, fieldErrors validator.ValidationErrors) ErrorValidateResponse
type FieldError ¶
type ModelDateTime ¶
Click to show internal directories.
Click to hide internal directories.