Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrorBadData errorType = "bad_data" ErrorNotFound errorType = "not_found" ErrorBadAuth errorType = "bad_auth" ErrorForbidden errorType = "no_permission" ErrorInternal errorType = "internal" )
View Source
const ( ResponseTypeJson responseType = "json" ResponseTypeHtml responseType = "html" ResponseTypeJpeg responseType = "jpeg" )
Variables ¶
This section is empty.
Functions ¶
func ResponseWrapper ¶
func ResponseWrapper(f HttpUseCase) http.HandlerFunc
Types ¶
type HandleError ¶
type HandleError struct { Type errorType `json:"type"` ErrorKey string `json:"error_key"` Message string `json:"message"` Err error `json:"-"` }
func (*HandleError) GetHttpStatus ¶
func (h *HandleError) GetHttpStatus() int
func (*HandleError) JsonEncode ¶
func (h *HandleError) JsonEncode() []byte
type HandleResult ¶
type HandleResult struct { Payload interface{} Type responseType Error *HandleError }
func (HandleResult) HasError ¶
func (h HandleResult) HasError() bool
type HttpUseCase ¶
type HttpUseCase func(r *http.Request) HandleResult
Click to show internal directories.
Click to hide internal directories.