Documentation ¶
Index ¶
- type Dep
- type EndpointHandler
- type ErrorResponseParam
- type HTTPResponse
- func (res HTTPResponse) GetContentType() string
- func (res HTTPResponse) GetData() interface{}
- func (res HTTPResponse) GetErrCode() int
- func (res HTTPResponse) GetError() error
- func (res HTTPResponse) GetErrorMessage() string
- func (res HTTPResponse) GetErrorMessageVerbose() string
- func (res HTTPResponse) GetStatus() int
- func (res HTTPResponse) HasError() bool
- func (res HTTPResponse) HasNoContent() bool
- func (res HTTPResponse) SetError(err error, errCode int, message string) HTTPResponse
- func (res HTTPResponse) SetErrorWithData(errParam ErrorResponseParam, data interface{}) HTTPResponse
- func (res HTTPResponse) SetErrorWithStatus(status int, err error, errCode int, message string) HTTPResponse
- func (res HTTPResponse) SetOk(data interface{}) HTTPResponse
- func (res HTTPResponse) SetOkWithStatus(status int, data interface{}) HTTPResponse
- func (res HTTPResponse) SetOkWithText(contentType string, data string) HTTPResponse
- type ResponseInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dep ¶
type Dep struct {
Log log.LoggerInterface
}
type EndpointHandler ¶
type EndpointHandler func(http.ResponseWriter, *http.Request) ResponseInterface
EndpointHandler ...
func (EndpointHandler) ServeHTTP ¶
func (fn EndpointHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ErrorResponseParam ¶
type HTTPResponse ¶
type HTTPResponse struct { Logger log.LoggerInterface // contains filtered or unexported fields }
func NewResponse ¶
func NewResponse(dep Dep) *HTTPResponse
func (HTTPResponse) GetContentType ¶ added in v1.1.0
func (res HTTPResponse) GetContentType() string
func (HTTPResponse) GetErrorMessage ¶
func (res HTTPResponse) GetErrorMessage() string
GetErrorMessage get error message from message or error object
func (HTTPResponse) GetErrorMessageVerbose ¶
func (res HTTPResponse) GetErrorMessageVerbose() string
GetErrorMessageVerbose get full string with error code, message and error object
func (HTTPResponse) SetError ¶
func (res HTTPResponse) SetError(err error, errCode int, message string) HTTPResponse
SetError ...
func (HTTPResponse) SetErrorWithData ¶
func (res HTTPResponse) SetErrorWithData(errParam ErrorResponseParam, data interface{}) HTTPResponse
func (HTTPResponse) SetErrorWithStatus ¶
func (res HTTPResponse) SetErrorWithStatus(status int, err error, errCode int, message string) HTTPResponse
SetErrorWithStatus ...
func (HTTPResponse) SetOkWithStatus ¶
func (res HTTPResponse) SetOkWithStatus(status int, data interface{}) HTTPResponse
SetOkWithStatus ...
func (HTTPResponse) SetOkWithText ¶ added in v1.1.0
func (res HTTPResponse) SetOkWithText(contentType string, data string) HTTPResponse
type ResponseInterface ¶
type ResponseInterface interface { SetOk(data interface{}) HTTPResponse SetOkWithStatus(status int, data interface{}) HTTPResponse SetOkWithText(contentType string, data string) HTTPResponse SetError(err error, errCode int, message string) HTTPResponse SetErrorWithStatus(status int, err error, errCode int, message string) HTTPResponse SetErrorWithData(errParam ErrorResponseParam, data interface{}) HTTPResponse HasError() bool GetData() interface{} GetError() error GetStatus() int GetErrCode() int GetErrorMessage() string GetErrorMessageVerbose() string HasNoContent() bool GetContentType() string }
Click to show internal directories.
Click to hide internal directories.