Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthCheckHandler ¶
func HealthCheckHandler(version, buildTime, commit string, serviceStatus map[string]interface{}, check func() error) http.HandlerFunc
HealthCheckHandler - function which generates a health check http.HandlerFunc
Types ¶
type AppError ¶
type AppError struct { Cause error `json:"-"` Message string `json:"message"` // description of failure ErrorCode string `json:"errorCode,omitempty"` // short error code string Code int `json:"code"` // status code for some reason Data interface{} `json:"data,omitempty"` // application specific data }
AppError is error type for json HTTP responses
func RenderContent ¶
RenderContent based on the header
func ValidationError ¶
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 / responses
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 ¶
type HealthCheckResponse struct {
Data HealthCheckResponseData `json:"data"`
}
HealthCheckResponse - response structure for healthchecks
type HealthCheckResponseData ¶
type HealthCheckResponseData struct { BuildTime string `json:"buildTime"` Commit string `json:"commit"` Version string `json:"version"` // service status is an accumulated map of service health structures mapped on service name ServiceStatus map[string]interface{} `json:"serviceStatus,omitempty"` }
HealthCheckResponseData - response structure for healthchecks
Click to show internal directories.
Click to hide internal directories.