Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthCheckHandler ¶ added in v0.3.0
func HealthCheckHandler(version, buildTime, commit string) http.HandlerFunc
HealthCheckHandler - function which generates a health check http.HandlerFunc
Types ¶
type AppError ¶
type AppError struct { Cause error `json:"-"` Message string `json:"message"` Code int `json:"code"` Data interface{} `json:"data,omitempty"` }
AppError is error type for json HTTP responses
func RenderContent ¶ added in v0.3.0
RenderContent based on the header
func ValidationError ¶ added in v0.2.0
ValidationError creates an error to communicate a bad request was formed
func WrapValidationError ¶
WrapValidationError from govalidator
type AppHandler ¶
type AppHandler func(http.ResponseWriter, *http.Request) *AppError
AppHandler is an http.Handler with JSON requests / reponses
func (AppHandler) ServeHTTP ¶
func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP responds via the passed handler and handles returned errors
type HealthCheckResponse ¶ added in v0.3.0
type HealthCheckResponse struct { BuildTime string `json:"build_time"` Commit string `json:"commit"` Version string `json:"version"` }
HealthCheckResponse - response structure for healthchecks
func (HealthCheckResponse) RenderJSON ¶ added in v0.3.0
func (hcr HealthCheckResponse) RenderJSON(ctx context.Context, w http.ResponseWriter) error
RenderJSON - helper to render a HealthCheckResponse as Json to an http.ResponseWriter
Click to show internal directories.
Click to hide internal directories.