Documentation
¶
Overview ¶
package handler provides a collection of useful/built-in handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { // Handler function. Handler http.HandlerFunc `json:"handler" validate:"required"` // Method to run the `Handler`. Method string `json:"method" validate:"required"` // Path to run the `Handler`. Path string `json:"path" validate:"required"` }
Handler definition.
func Liveness ¶
func Liveness() Handler
Liveness indicates the server is up, and running. It follows the "standard" which is send `200` status code, and "OK" in the body.
func Readiness ¶
func Readiness(readinessStates ...*ReadinessDeterminer) Handler
Readiness indicates the server is up, running, and ready to work. It follows the "standard" which is send `200` status code, and "OK" in the body if it's ready, otherwise sends `503`, "Service Unavailable", and the error. Multiple readinesses determiners can be passed. In this case, only if ALL are ready, the server will be considered ready.
type ReadinessDeterminer ¶ added in v0.0.4
type ReadinessDeterminer struct {
// contains filtered or unexported fields
}
ReadinessDeterminer definition. It determines if `name` is ready.
func NewReadinessDeterminer ¶ added in v0.0.4
func NewReadinessDeterminer(name string) *ReadinessDeterminer
NewReadinessDeterminer is the Readiness factory.
func (*ReadinessDeterminer) GetName ¶ added in v0.0.4
func (t *ReadinessDeterminer) GetName() string
Get state name.
func (*ReadinessDeterminer) GetReadiness ¶ added in v0.0.4
func (t *ReadinessDeterminer) GetReadiness() bool
Get readiness state.
func (*ReadinessDeterminer) SetName ¶ added in v0.0.4
func (t *ReadinessDeterminer) SetName(name string)
Set state name.
func (*ReadinessDeterminer) SetReadiness ¶ added in v0.0.4
func (t *ReadinessDeterminer) SetReadiness(v bool)
Set readiness state.