Documentation ¶
Overview ¶
httpio handles encoding and decoding for http i/o. This package is used to standardize request and response handling.
Index ¶
- func CauseIsError(err error) bool
- func HasBadRequest(err error) bool
- func HasClientMessage(err error) bool
- func HasConflict(err error) bool
- func HasForbidden(err error) bool
- func HasInternalServerError(err error) bool
- func HasNotFound(err error) bool
- func HasServiceUnavailable(err error) bool
- func HasUnauthorized(err error) bool
- func Message(err error) string
- func Messages(err error) []string
- func NewBadRequest() errors.Chain
- func NewBadRequestMessage(message string) errors.Chain
- func NewBadRequestMessageWithError(err error, message string) errors.Chain
- func NewBadRequestMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewBadRequestMessagef(format string, a ...any) errors.Chain
- func NewBadRequestWithError(err error) errors.Chain
- func NewConflict() errors.Chain
- func NewConflictMessage(message string) errors.Chain
- func NewConflictMessageWithError(err error, message string) errors.Chain
- func NewConflictMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewConflictMessagef(format string, a ...any) errors.Chain
- func NewConflictWithError(err error) errors.Chain
- func NewForbidden() errors.Chain
- func NewForbiddenMessage(message string) errors.Chain
- func NewForbiddenMessageWithError(err error, message string) errors.Chain
- func NewForbiddenMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewForbiddenMessagef(format string, a ...any) errors.Chain
- func NewForbiddenWithError(err error) errors.Chain
- func NewInternalServerError() errors.Chain
- func NewInternalServerErrorMessage(message string) errors.Chain
- func NewInternalServerErrorMessageWithError(err error, message string) errors.Chain
- func NewInternalServerErrorMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewInternalServerErrorMessagef(format string, a ...any) errors.Chain
- func NewInternalServerErrorWithError(err error) errors.Chain
- func NewNotFound() errors.Chain
- func NewNotFoundMessage(message string) errors.Chain
- func NewNotFoundMessageWithError(err error, message string) errors.Chain
- func NewNotFoundMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewNotFoundMessagef(format string, a ...any) errors.Chain
- func NewNotFoundWithError(err error) errors.Chain
- func NewServiceUnavailable() errors.Chain
- func NewServiceUnavailableMessage(message string) errors.Chain
- func NewServiceUnavailableMessageWithError(err error, message string) errors.Chain
- func NewServiceUnavailableMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewServiceUnavailableMessagef(format string, a ...any) errors.Chain
- func NewServiceUnavailableWithError(err error) errors.Chain
- func NewUnauthorized() errors.Chain
- func NewUnauthorizedMessage(message string) errors.Chain
- func NewUnauthorizedMessageWithError(err error, message string) errors.Chain
- func NewUnauthorizedMessageWithErrorf(err error, format string, a ...any) errors.Chain
- func NewUnauthorizedMessagef(format string, a ...any) errors.Chain
- func NewUnauthorizedWithError(err error) errors.Chain
- func Param[T any](r *http.Request, param ParamType) (val T)
- func WithParams(next http.Handler) http.Handler
- type ClientMessage
- type Decoder
- type Encoder
- func (e *Encoder) BadRequest(ctx context.Context) error
- func (e *Encoder) BadRequestMessage(ctx context.Context, message string) error
- func (e *Encoder) BadRequestMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) BadRequestMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) BadRequestMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) BadRequestWithError(ctx context.Context, err error) error
- func (e *Encoder) ClientMessage(ctx context.Context, err error) error
- func (e *Encoder) Conflict(ctx context.Context) error
- func (e *Encoder) ConflictMessage(ctx context.Context, message string) error
- func (e *Encoder) ConflictMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) ConflictMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) ConflictMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) ConflictWithError(ctx context.Context, err error) error
- func (e *Encoder) Forbidden(ctx context.Context) error
- func (e *Encoder) ForbiddenMessage(ctx context.Context, message string) error
- func (e *Encoder) ForbiddenMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) ForbiddenMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) ForbiddenMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) ForbiddenWithError(ctx context.Context, err error) error
- func (e *Encoder) InternalServerError(ctx context.Context) error
- func (e *Encoder) InternalServerErrorMessage(ctx context.Context, message string) error
- func (e *Encoder) InternalServerErrorMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) InternalServerErrorMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) InternalServerErrorMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) InternalServerErrorWithError(ctx context.Context, err error) error
- func (e *Encoder) NotFound(ctx context.Context) error
- func (e *Encoder) NotFoundMessage(ctx context.Context, message string) error
- func (e *Encoder) NotFoundMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) NotFoundMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) NotFoundMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) NotFoundWithError(ctx context.Context, err error) error
- func (e *Encoder) Ok(body interface{}) error
- func (e *Encoder) ServiceUnavailable(ctx context.Context) error
- func (e *Encoder) ServiceUnavailableMessage(ctx context.Context, message string) error
- func (e *Encoder) ServiceUnavailableMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) ServiceUnavailableMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) ServiceUnavailableMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) ServiceUnavailableWithError(ctx context.Context, err error) error
- func (e *Encoder) StatusCodeWithBody(statusCode int, body interface{}) error
- func (e *Encoder) Unauthorized(ctx context.Context) error
- func (e *Encoder) UnauthorizedMessage(ctx context.Context, message string) error
- func (e *Encoder) UnauthorizedMessageWithError(ctx context.Context, err error, message string) error
- func (e *Encoder) UnauthorizedMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
- func (e *Encoder) UnauthorizedMessagef(ctx context.Context, format string, a ...any) error
- func (e *Encoder) UnauthorizedWithError(ctx context.Context, err error) error
- type HTTPEncoder
- type MessageResponse
- type ParamType
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CauseIsError ¶ added in v0.2.0
CauseIsError returns true if the Cause of this error is an error vs a ClientMessage with nil error
func HasBadRequest ¶ added in v0.2.0
HasBadRequest checks if the error contains a BadRequest (400) message
func HasClientMessage ¶ added in v0.2.0
HasClientMessage checks if the error contains a client message
func HasConflict ¶ added in v0.2.0
HasConflict checks if the error contains a Conflict (409) message
func HasForbidden ¶ added in v0.2.0
HasForbidden checks if the error contains a Forbidden (403) message
func HasInternalServerError ¶ added in v0.2.0
HasInternalServerError checks if the error contains an InternalServerError (500) message
func HasNotFound ¶ added in v0.2.0
HasNotFound checks if the error contains a NotFound (404) message
func HasServiceUnavailable ¶ added in v0.2.0
HasServiceUnavailable checks if the error contains a ServiceUnavailable (503) message
func HasUnauthorized ¶ added in v0.2.0
HasUnauthorized checks if the error contains an Unauthorized (401) message
func Message ¶ added in v0.2.0
Message returns the message from the wrapped ClientMessage or an empty string
func Messages ¶ added in v0.2.0
Messages returns a slice of messages from the ClientMessage's contained within the chain of errors
func NewBadRequest ¶ added in v0.2.0
func NewBadRequest() errors.Chain
NewBadRequest creates a new empty client message with a BadRequest (400) return code
func NewBadRequestMessage ¶ added in v0.2.0
func NewBadRequestMessage(message string) errors.Chain
NewBadRequestMessage creates a new client message with a BadRequest (400) return code
func NewBadRequestMessageWithError ¶ added in v0.2.0
NewBadRequestMessageWithError wraps an existing error while creating a new client message with a BadRequest (400) return code
func NewBadRequestMessageWithErrorf ¶ added in v0.2.0
NewBadRequestMessageWithErrorf wraps an existing error while creating a new client message with a BadRequest (400) return code
func NewBadRequestMessagef ¶ added in v0.2.0
NewBadRequestMessagef creates a new client message with a BadRequest (400) return code
func NewBadRequestWithError ¶ added in v0.2.0
func NewBadRequestWithError(err error) errors.Chain
NewBadRequestWithError wraps an existing error while creating a new empty client message and a BadRequest (400) return code
func NewConflict ¶ added in v0.2.0
func NewConflict() errors.Chain
NewConflict creates a new empty client message with a Conflict (409) return code
func NewConflictMessage ¶ added in v0.2.0
func NewConflictMessage(message string) errors.Chain
NewConflictMessage creates a new client message with a Conflict (409) return code
func NewConflictMessageWithError ¶ added in v0.2.0
NewConflictMessageWithError wraps an existing error while creating a new client message with a Conflict (409) return code
func NewConflictMessageWithErrorf ¶ added in v0.2.0
NewConflictMessageWithErrorf wraps an existing error while creating a new client message with a Conflict (409) return code
func NewConflictMessagef ¶ added in v0.2.0
NewConflictMessagef creates a new client message with a Conflict (409) return code
func NewConflictWithError ¶ added in v0.2.0
func NewConflictWithError(err error) errors.Chain
NewConflictWithError wraps an existing error while creating a new empty client message and a Conflict (409) return code
func NewForbidden ¶ added in v0.2.0
func NewForbidden() errors.Chain
NewForbidden creates a new empty client message with a Forbidden (403) return code
func NewForbiddenMessage ¶ added in v0.2.0
func NewForbiddenMessage(message string) errors.Chain
NewForbiddenMessage creates a new client message with a Forbidden (403) return code
func NewForbiddenMessageWithError ¶ added in v0.2.0
NewForbiddenMessageWithError wraps an existing error while creating a new client message with a Forbidden (403) return code
func NewForbiddenMessageWithErrorf ¶ added in v0.2.0
NewForbiddenMessageWithErrorf wraps an existing error while creating a new client message with a Forbidden (403) return code
func NewForbiddenMessagef ¶ added in v0.2.0
NewForbiddenMessagef creates a new client message with a Forbidden (403) return code
func NewForbiddenWithError ¶ added in v0.2.0
func NewForbiddenWithError(err error) errors.Chain
NewForbiddenWithError wraps an existing error while creating a new empty client message and a Forbidden (403) return code
func NewInternalServerError ¶ added in v0.2.0
func NewInternalServerError() errors.Chain
NewInternalServerError creates a new empty client message with a InternalServerError (500) return code
func NewInternalServerErrorMessage ¶ added in v0.2.0
func NewInternalServerErrorMessage(message string) errors.Chain
NewInternalServerErrorMessage creates a new client message with a InternalServerError (500) return code
func NewInternalServerErrorMessageWithError ¶ added in v0.2.0
NewInternalServerErrorMessageWithError wraps an existing error while creating a new client message with a InternalServerError (500) return code
func NewInternalServerErrorMessageWithErrorf ¶ added in v0.2.0
NewInternalServerErrorMessageWithErrorf wraps an existing error while creating a new client message with a InternalServerError (500) return code
func NewInternalServerErrorMessagef ¶ added in v0.2.0
NewInternalServerErrorMessagef creates a new client message with a InternalServerError (500) return code
func NewInternalServerErrorWithError ¶ added in v0.2.0
func NewInternalServerErrorWithError(err error) errors.Chain
NewInternalServerErrorWithError wraps an existing error while creating a new empty client message and a InternalServerError (500) return code
func NewNotFound ¶ added in v0.2.0
func NewNotFound() errors.Chain
NewNotFound creates a new empty client message with a NotFound (404) return code
func NewNotFoundMessage ¶ added in v0.2.0
func NewNotFoundMessage(message string) errors.Chain
NewNotFoundMessage creates a new client message with a NotFound (404) return code
func NewNotFoundMessageWithError ¶ added in v0.2.0
NewNotFoundMessageWithError wraps an existing error while creating a new client message with a NotFound (404) return code
func NewNotFoundMessageWithErrorf ¶ added in v0.2.0
NewNotFoundMessageWithErrorf wraps an existing error while creating a new client message with a NotFound (404) return code
func NewNotFoundMessagef ¶ added in v0.2.0
NewNotFoundMessagef creates a new client message with a NotFound (404) return code
func NewNotFoundWithError ¶ added in v0.2.0
func NewNotFoundWithError(err error) errors.Chain
NewNotFoundWithError wraps an existing error while creating a new empty client message and a NotFound (404) return code
func NewServiceUnavailable ¶ added in v0.2.0
func NewServiceUnavailable() errors.Chain
NewServiceUnavailable creates a new empty client message with a ServiceUnavailable (503) return code
func NewServiceUnavailableMessage ¶ added in v0.2.0
func NewServiceUnavailableMessage(message string) errors.Chain
NewServiceUnavailableMessage creates a new client message with a ServiceUnavailable (503) return code
func NewServiceUnavailableMessageWithError ¶ added in v0.2.0
NewServiceUnavailableMessageWithError wraps an existing error while creating a new client message with a ServiceUnavailable (503) return code
func NewServiceUnavailableMessageWithErrorf ¶ added in v0.2.0
NewServiceUnavailableMessageWithErrorf wraps an existing error while creating a new client message with a ServiceUnavailable (503) return code
func NewServiceUnavailableMessagef ¶ added in v0.2.0
NewServiceUnavailableMessagef creates a new client message with a ServiceUnavailable (503) return code
func NewServiceUnavailableWithError ¶ added in v0.2.0
func NewServiceUnavailableWithError(err error) errors.Chain
NewServiceUnavailableWithError wraps an existing error while creating a new empty client message and a ServiceUnavailable (503) return code
func NewUnauthorized ¶ added in v0.2.0
func NewUnauthorized() errors.Chain
NewUnauthorized creates a new empty client message with a Unauthorized (401) return code
func NewUnauthorizedMessage ¶ added in v0.2.0
func NewUnauthorizedMessage(message string) errors.Chain
NewUnauthorizedMessage creates a new client message with a Unauthorized (401) return code
func NewUnauthorizedMessageWithError ¶ added in v0.2.0
NewUnauthorizedMessageWithError wraps an existing error while creating a new client message with a Unauthorized (401) return code
func NewUnauthorizedMessageWithErrorf ¶ added in v0.2.0
NewUnauthorizedMessageWithErrorf wraps an existing error while creating a new client message with a Unauthorized (401) return code
func NewUnauthorizedMessagef ¶ added in v0.2.0
NewUnauthorizedMessagef creates a new client message with a Unauthorized (401) return code
func NewUnauthorizedWithError ¶ added in v0.2.0
func NewUnauthorizedWithError(err error) errors.Chain
NewUnauthorizedWithError wraps an existing error while creating a new empty client message and a Unauthorized (401) return code
Types ¶
type ClientMessage ¶ added in v0.2.0
type ClientMessage struct {
// contains filtered or unexported fields
}
ClientMessage is a custom message type that can be used to return client messages
func (*ClientMessage) Error ¶ added in v0.2.0
func (c *ClientMessage) Error() string
Error returns the error message
func (*ClientMessage) Message ¶ added in v0.2.0
func (c *ClientMessage) Message() string
Message returns the client message
func (*ClientMessage) Unwrap ¶ added in v0.2.0
func (c *ClientMessage) Unwrap() error
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is a struct that can be used for decoding http requests and validating those requests
func NewDecoder ¶
func NewDecoder(req *http.Request, validator ValidatorFunc) *Decoder
NewDecoder returns a pointer to a new Decoder struct
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder is a struct that is used for encoding http responses
func NewEncoder ¶
func NewEncoder(w http.ResponseWriter) *Encoder
NewEncoder returns a new Encoder to write to the ResponseWriter This encoder will write to the ResponseWriter using a json encoder.
func (*Encoder) BadRequest ¶
BadRequest creates a new empty client message with a BadRequest (400) return code
func (*Encoder) BadRequestMessage ¶ added in v0.2.0
BadRequestMessage creates a new client message with a BadRequest (400) return code
func (*Encoder) BadRequestMessageWithError ¶ added in v0.2.0
BadRequestMessageWithError wraps an existing error while creating a new client message with a BadRequest (400) return code
func (*Encoder) BadRequestMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) BadRequestMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
BadRequestMessageWithErrorf wraps an existing error while creating a new client message with a BadRequest (400) return code
func (*Encoder) BadRequestMessagef ¶ added in v0.2.0
BadRequestMessagef creates a new client message with a BadRequest (400) return code
func (*Encoder) BadRequestWithError ¶ added in v0.2.0
BadRequestWithError wraps an existing error while creating a new empty client message and a BadRequest (400) return code
func (*Encoder) ClientMessage ¶ added in v0.2.0
ClientMessage sets an http code and formats a client message based upon the message type found in the error chain. If no message type is found it defaults to InternalServerError (500) with no message
func (*Encoder) Conflict ¶
Conflict creates a new empty client message with a Conflict (409) return code
func (*Encoder) ConflictMessage ¶ added in v0.2.0
ConflictMessage creates a new client message with a Conflict (409) return code
func (*Encoder) ConflictMessageWithError ¶ added in v0.2.0
ConflictMessageWithError wraps an existing error while creating a new client message with a Conflict (409) return code
func (*Encoder) ConflictMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) ConflictMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
ConflictMessageWithErrorf wraps an existing error while creating a new client message with a Conflict (409) return code
func (*Encoder) ConflictMessagef ¶ added in v0.2.0
ConflictMessagef creates a new client message with a Conflict (409) return code
func (*Encoder) ConflictWithError ¶ added in v0.2.0
ConflictWithError wraps an existing error while creating a new empty client message and a Conflict (409) return code
func (*Encoder) Forbidden ¶
Forbidden creates a new empty client message with a Forbidden (403) return code
func (*Encoder) ForbiddenMessage ¶ added in v0.2.0
ForbiddenMessage creates a new client message with a Forbidden (403) return code
func (*Encoder) ForbiddenMessageWithError ¶ added in v0.2.0
ForbiddenMessageWithError wraps an existing error while creating a new client message with a Forbidden (403) return code
func (*Encoder) ForbiddenMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) ForbiddenMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
ForbiddenMessageWithErrorf wraps an existing error while creating a new client message with a Forbidden (403) return code
func (*Encoder) ForbiddenMessagef ¶ added in v0.2.0
ForbiddenMessagef creates a new client message with a Forbidden (403) return code
func (*Encoder) ForbiddenWithError ¶ added in v0.2.0
ForbiddenWithError wraps an existing error while creating a new empty client message and a Forbidden (403) return code
func (*Encoder) InternalServerError ¶
InternalServerError creates a new empty client message with a InternalServerError (500) return code
func (*Encoder) InternalServerErrorMessage ¶ added in v0.2.0
InternalServerErrorMessage creates a new client message with a InternalServerError (500) return code
func (*Encoder) InternalServerErrorMessageWithError ¶ added in v0.2.0
func (e *Encoder) InternalServerErrorMessageWithError(ctx context.Context, err error, message string) error
InternalServerErrorMessageWithError wraps an existing error while creating a new client message with a InternalServerError (500) return code
func (*Encoder) InternalServerErrorMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) InternalServerErrorMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
InternalServerErrorMessageWithErrorf wraps an existing error while creating a new client message with a InternalServerError (500) return code
func (*Encoder) InternalServerErrorMessagef ¶ added in v0.2.0
InternalServerErrorMessagef creates a new client message with a InternalServerError (500) return code
func (*Encoder) InternalServerErrorWithError ¶ added in v0.2.0
InternalServerErrorWithError wraps an existing error while creating a new empty client message and a InternalServerError (500) return code
func (*Encoder) NotFound ¶
NotFound creates a new empty client message with a NotFound (404) return code
func (*Encoder) NotFoundMessage ¶ added in v0.2.0
NotFoundMessage creates a new client message with a NotFound (404) return code
func (*Encoder) NotFoundMessageWithError ¶ added in v0.2.0
NotFoundMessageWithError wraps an existing error while creating a new client message with a NotFound (404) return code
func (*Encoder) NotFoundMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) NotFoundMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
NotFoundMessageWithErrorf wraps an existing error while creating a new client message with a NotFound (404) return code
func (*Encoder) NotFoundMessagef ¶ added in v0.2.0
NotFoundMessagef creates a new client message with a NotFound (404) return code
func (*Encoder) NotFoundWithError ¶ added in v0.2.0
NotFoundWithError wraps an existing error while creating a new empty client message and a NotFound (404) return code
func (*Encoder) ServiceUnavailable ¶
ServiceUnavailable creates a new empty client message with a ServiceUnavailable (503) return code
func (*Encoder) ServiceUnavailableMessage ¶ added in v0.2.0
ServiceUnavailableMessage creates a new client message with a ServiceUnavailable (503) return code
func (*Encoder) ServiceUnavailableMessageWithError ¶ added in v0.2.0
func (e *Encoder) ServiceUnavailableMessageWithError(ctx context.Context, err error, message string) error
ServiceUnavailableMessageWithError wraps an existing error while creating a new client message with a ServiceUnavailable (503) return code
func (*Encoder) ServiceUnavailableMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) ServiceUnavailableMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
ServiceUnavailableMessageWithErrorf wraps an existing error while creating a new client message with a ServiceUnavailable (503) return code
func (*Encoder) ServiceUnavailableMessagef ¶ added in v0.2.0
ServiceUnavailableMessagef creates a new client message with a ServiceUnavailable (503) return code
func (*Encoder) ServiceUnavailableWithError ¶ added in v0.2.0
ServiceUnavailableWithError wraps an existing error while creating a new empty client message and a ServiceUnavailable (503) return code
func (*Encoder) StatusCodeWithBody ¶ added in v0.2.0
StatusCodeWithBody writes a statusCode and body
func (*Encoder) Unauthorized ¶
Unauthorized creates a new empty client message with a Unauthorized (401) return code
func (*Encoder) UnauthorizedMessage ¶ added in v0.2.0
UnauthorizedMessage creates a new client message with a Unauthorized (401) return code
func (*Encoder) UnauthorizedMessageWithError ¶ added in v0.2.0
func (e *Encoder) UnauthorizedMessageWithError(ctx context.Context, err error, message string) error
UnauthorizedMessageWithError wraps an existing error while creating a new client message with a Unauthorized (401) return code
func (*Encoder) UnauthorizedMessageWithErrorf ¶ added in v0.2.0
func (e *Encoder) UnauthorizedMessageWithErrorf(ctx context.Context, err error, format string, a ...any) error
UnauthorizedMessageWithErrorf wraps an existing error while creating a new client message with a Unauthorized (401) return code
func (*Encoder) UnauthorizedMessagef ¶ added in v0.2.0
UnauthorizedMessagef creates a new client message with a Unauthorized (401) return code
type HTTPEncoder ¶
type HTTPEncoder interface { // Encode is the call that is made to encode data into a response body and returns an error if it fails Encode(v interface{}) error }
HTTPEncoder is an interface that is accepted when encoding http responses
type MessageResponse ¶
type MessageResponse struct { Message string `json:"message,omitempty"` TraceID string `json:"traceId,omitempty"` }
MessageResponse holds a standard structure for http responses that carry a single message This also includes a trace ID for debugging purposes
type ParamType ¶ added in v0.0.2
type ParamType string
ParamType defines the type used to describe url Params
type ValidatorFunc ¶
type ValidatorFunc func(s interface{}) error
ValidatorFunc is a function that validates s It returns an error if the validation fails