health

package
v0.0.0-...-dc7611c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusUp   = "up"
	StatusDown = "down"
)

Variables

View Source
var Module = fx.Options(
	fx.Provide(
		NewHealthService,
		NewHealthCheckEndpoint,
	),
	fx.Invoke(func(endpoint *HealthCheckEndpoint) {
		endpoint.RegisterEndpoints()
	}),
)

Functions

This section is empty.

Types

type Check

type Check map[string]Status

func (Check) AllUp

func (check Check) AllUp() bool

type Health

type Health interface {
	CheckHealth(ctx context.Context) error
	GetHealthName() string
}

type HealthCheckEndpoint

type HealthCheckEndpoint struct {
	// contains filtered or unexported fields
}

func NewHealthCheckEndpoint

func NewHealthCheckEndpoint(
	service HealthService,
	server customEcho.EchoHttpServer,
) *HealthCheckEndpoint

func (*HealthCheckEndpoint) CheckHealth

func (s *HealthCheckEndpoint) CheckHealth(c echo.Context) error

func (*HealthCheckEndpoint) RegisterEndpoints

func (s *HealthCheckEndpoint) RegisterEndpoints()

type HealthParams

type HealthParams struct {
	fx.In

	Healths []Health `group:"healths"`
}

type HealthService

type HealthService interface {
	CheckHealth(ctx context.Context) Check
}

func NewHealthService

func NewHealthService(
	healthParams HealthParams,
) HealthService

type Status

type Status struct {
	Status string `json:"status"`
}

func NewStatus

func NewStatus(err error) Status

func (Status) IsUp

func (status Status) IsUp() bool

type UnhealthyHealthService

type UnhealthyHealthService struct{}

func NewUnhealthyHealthService

func NewUnhealthyHealthService() UnhealthyHealthService

func (UnhealthyHealthService) CheckHealth

func (service UnhealthyHealthService) CheckHealth(context.Context) Check

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL