Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientIPFunc ¶
ClientIPFunc is a function that can be used to retrieve the client IP from a context.
type Conflicter ¶
type Conflicter interface {
Conflict() bool
}
Conflicter determines if an error exhibits the behavior of a conflict err. This corresponds to times when you receive unexpected errors or an error of high severity.
type ErrJSON ¶
type ErrJSON struct {
// contains filtered or unexported fields
}
ErrJSON error is returned by Decode when the incoming JSON unmarshaling fails.
func (*ErrJSON) StatusCode ¶
StatusCode returns the http status code that would refer to json payload that fails to decode error.
type ErrValidationFailed ¶
type ErrValidationFailed struct {
// contains filtered or unexported fields
}
ErrValidationFailed is returned by Decode if the object is not valid.
func (*ErrValidationFailed) Error ¶
func (e *ErrValidationFailed) Error() string
Error reports the error string.
func (*ErrValidationFailed) StatusCode ¶
func (e *ErrValidationFailed) StatusCode() int
StatusCode returns the http status code that would refer to a validation error.
type ErrorResponse ¶
ErrorResponse is the body of an Error served up by Err
type Exister ¶
type Exister interface {
Exists() bool
}
Exister determines if an error exhibits the behavior of a resource already exists err.
type HTTP ¶
type HTTP interface {
StatusCode() int
}
HTTP determines if an error exhibits the behavior of an error that provides an HTTP status code and the error message itself is safe for returning to a client.
type HTTPErr ¶
type HTTPErr struct {
Code int
// contains filtered or unexported fields
}
HTTPErr is a error that provides a status code.
func (*HTTPErr) StatusCode ¶
StatusCode provides the status code associated with the error message.
type NotFounder ¶
type NotFounder interface {
NotFound() bool
}
NotFounder determines if an error exhibits the behavior of a resource not found err.
type RequestIDFunc ¶
RequestIDFunc is a function that can be used to retrieve the request ID from a context.
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
Responder writes API responses.
func NewResponder ¶
func NewResponder(logger *logger.L, opts ...ResponderOption) *Responder
NewResponder makes a new Responder object.
type ResponderOption ¶
type ResponderOption func(*options)
ResponderOption is used to customize the API responder.
func WithClientIPFunc ¶
func WithClientIPFunc(fn ClientIPFunc) ResponderOption
WithClientIPFunc sets the function to retrieve the client IP.
func WithLogResponseBodies ¶
func WithLogResponseBodies(enabled bool) ResponderOption
WithLogResponseBodies enables the logging of response bodies.
func WithRequestIDFunc ¶
func WithRequestIDFunc(fn RequestIDFunc) ResponderOption
WithRequestIDFunc sets the function to retrieve the request ID.