Documentation ¶
Index ¶
- func Encode(w http.ResponseWriter, r *http.Request, status int, data interface{})
- func Failure(w http.ResponseWriter, status int, err ErrorMessage)
- func FailureFromError(w http.ResponseWriter, status int, err error)
- func FailureFromValidator(w http.ResponseWriter, result *validate.Result)
- func InternalServerFailure(w http.ResponseWriter)
- func MethodNotAllowedFailure(w http.ResponseWriter, r *http.Request)
- func NotFoundFailure(w http.ResponseWriter, r *http.Request)
- func Register(encoder encoder.Encoder)
- func ServiceUnavailableFailure(w http.ResponseWriter, retry time.Duration)
- func StatusCode(w http.ResponseWriter) int
- type ErrorMessage
- type ErrorMessageInterface
- type ErrorResponse
- type ErrorsResponse
- type ValidatorError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
func Encode(w http.ResponseWriter, r *http.Request, status int, data interface{})
Encode data to HTTP response
func FailureFromError ¶
func FailureFromError(w http.ResponseWriter, status int, err error)
FailureFromError write ErrorMessage from error
func FailureFromValidator ¶
func FailureFromValidator(w http.ResponseWriter, result *validate.Result)
FailureFromValidator response
func InternalServerFailure ¶
func InternalServerFailure(w http.ResponseWriter)
InternalServerFailure response
func MethodNotAllowedFailure ¶
func MethodNotAllowedFailure(w http.ResponseWriter, r *http.Request)
MethodNotAllowedFailure response
func NotFoundFailure ¶
func NotFoundFailure(w http.ResponseWriter, r *http.Request)
NotFoundFailure response
func ServiceUnavailableFailure ¶
func ServiceUnavailableFailure(w http.ResponseWriter, retry time.Duration)
ServiceUnavailableFailure response
func StatusCode ¶
func StatusCode(w http.ResponseWriter) int
StatusCode returns the HTTP response status. Remember that the status is only set by the server after WriteHeader has been called.
Types ¶
type ErrorMessage ¶
ErrorMessage struct
func (ErrorMessage) Error ¶
func (e ErrorMessage) Error() string
Error implements ErrorMessageInterface
func (ErrorMessage) GetCode ¶
func (e ErrorMessage) GetCode() int
GetCode implements ErrorMessageInterface
func (ErrorMessage) GetMessage ¶
func (e ErrorMessage) GetMessage() string
GetMessage implements ErrorMessageInterface
type ErrorMessageInterface ¶
ErrorMessageInterface interface
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorMessage `json:"error"`
}
ErrorResponse struct
type ErrorsResponse ¶
type ErrorsResponse struct {
Errors []error `json:"errors"`
}
ErrorsResponse struct
type ValidatorError ¶
type ValidatorError struct { Code int32 `json:"code,omitempty"` Name string `json:"name,omitempty"` In string `json:"in,omitempty"` Value interface{} `json:"value,omitempty"` Message string `json:"message"` Values []interface{} `json:"values,omitempty"` }
ValidatorError struct
func (ValidatorError) Error ¶
func (e ValidatorError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.