Documentation
¶
Index ¶
- func ActuatorEndpointOpt() fx.Option
- func AppOpt() fx.Option
- func BuildInfoOpt(version string, commitHash string, time string) fx.Option
- func FiberServerOpt() fx.Option
- func LoggingOpt() fx.Option
- func NewFiberServer(config *properties.FiberProperties, app *App) *fiber.App
- func NewPropertiesLoader(in PropertiesLoaderIn) (config.Loader, error)
- func NewZapLogger(in ZapLoggerIn) (*log.ZapLogger, error)
- func OnStartHttpServerHook(lc fx.Lifecycle, app *App, fiberServer *fiber.App, ...)
- func OnStopHttpServerHook(lc fx.Lifecycle, server *fiber.App)
- func OnStopHttpServerOpt() fx.Option
- func PropertiesOpt() fx.Option
- func ProvideHealthChecker(healthCheckerConstructor interface{}) fx.Option
- func ProvideInformer(informerConstructor interface{}) fx.Option
- func ProvideProps(propConstructor interface{}) fx.Option
- func ProvidePropsOption(option Option) fx.Option
- func RegisterHandlers(app *App, engine *fiber.App)
- func RegisterLogger(fiberZapLogger log.Logger)
- func RegisterRequestContextMiddleware(app *App, zapLogger *log.ZapLogger, ...)
- type ActuatorIn
- type ActuatorOut
- type App
- type Option
- type PropertiesLoaderIn
- type ZapLoggerIn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActuatorEndpointOpt ¶
func FiberServerOpt ¶
func LoggingOpt ¶
func NewFiberServer ¶
func NewFiberServer(config *properties.FiberProperties, app *App) *fiber.App
func NewPropertiesLoader ¶
func NewPropertiesLoader(in PropertiesLoaderIn) (config.Loader, error)
func NewZapLogger ¶
func NewZapLogger(in ZapLoggerIn) (*log.ZapLogger, error)
func OnStartHttpServerHook ¶
func OnStartHttpServerHook(lc fx.Lifecycle, app *App, fiberServer *fiber.App, fiberConfig *properties.FiberProperties)
func OnStopHttpServerOpt ¶
func PropertiesOpt ¶
func ProvideHealthChecker ¶
ProvideHealthChecker A simple way to provide a health checker
func ProvideInformer ¶
ProvideInformer A simple way to provide an informer
func ProvideProps ¶
func ProvidePropsOption ¶
func RegisterHandlers ¶
func RegisterLogger ¶
func RegisterRequestContextMiddleware ¶
func RegisterRequestContextMiddleware( app *App, zapLogger *log.ZapLogger, httpRequestLogProperties *properties.HttpRequestLogProperties, )
Types ¶
type ActuatorIn ¶
type ActuatorIn struct {
fx.In
Props *config.AppProperties
Checkers []actuator.HealthChecker `group:"actuator_health_checker"`
Informers []actuator.Informer `group:"actuator_informer"`
}
type ActuatorOut ¶
type ActuatorOut struct {
fx.Out
Endpoint *webActuator.Endpoint
HealthService actuator.HealthService
InformerService actuator.InfoService
}
func NewActuatorEndpoint ¶
func NewActuatorEndpoint(in ActuatorIn) ActuatorOut
NewActuatorEndpoint Initiate actuator endpoint with health checker and informer automatically.
================= Health Checker ====================== To register a Health Checker, your component have to produce an actuator.HealthChecker with group `actuator_health_checker` in the result of provider function. For example, a redis provider produce the following result:
type RedisOut struct {
fx.Out
Client *redis.Client
HealthChecker actuator.HealthChecker `group:"actuator_health_checker"`
}
func NewRedis() (RedisOut, error) {}
or using ProvideHealthChecker
func NewSampleHealthChecker() actuator.HealthChecker {
return &SampleHealthChecker{}
}
ProvideHealthChecker(NewSampleHealthChecker)
=================== Informer ========================= Similar to Health Checker, an Informer also registered by produce an actuator.Informer. For example, a GitRevision provider produce the following result:
type GitRevisionOut struct {
fx.Out
Informer actuator.Informer `group:"actuator_informer"`
}
func NewGitRevision() (GitRevisionOut, error) {}
or using ProvideInformer
func NewSampleInformer() actuator.Informer {
return &SampleInformer{}
}
ProvideInformer(NewSampleInformer)
type PropertiesLoaderIn ¶
type PropertiesLoaderIn struct {
fx.In
Properties []config.Properties `group:"properties"`
Options []Option `group:"properties_option"`
}
type ZapLoggerIn ¶
type ZapLoggerIn struct {
fx.In
Props *log.Properties
ContextExtractors []log.ContextExtractor `group:"log_context_extractor"`
}