Documentation ¶
Index ¶
- func ActuatorEndpointOpt() fx.Option
- func AppOpt() fx.Option
- func BuildInfoOpt(version string, commitHash string, time string) fx.Option
- func EventOpt() fx.Option
- func HttpClientOpt() fx.Option
- func HttpRequestLogOpt() fx.Option
- func LoggingOpt() fx.Option
- func NewContextualHttpClient(in ContextualHttpClientIn) (client.ContextualHttpClient, error)
- func NewDefaultEventBus(in EventBusIn) pubsub.EventBus
- func NewDefaultEventPublisher(in EventPublisherIn) pubsub.Publisher
- func NewPropertiesLoader(in PropertiesLoaderIn) (config.Loader, error)
- func NewZapLogger(in ZapLoggerIn) (log.Logger, error)
- func OnStopEventOpt() fx.Option
- func PropertiesOpt() fx.Option
- func ProvideEventBusOpt(optConstructor interface{}) fx.Option
- func ProvideEventListener(listener interface{}) fx.Option
- func ProvideEventPublisherOpt(optConstructor interface{}) 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 RegisterEventPublisher(in RegisterEventPublisherIn)
- func RegisterLogContextExtractor(extractor log.ContextExtractor) fx.Option
- func RegisterLogger(logger log.Logger)
- func RunEventBus(bus pubsub.EventBus)
- func SupplyEventBusOpt(opt pubsub.EventBusOpt) fx.Option
- func SupplyEventPublisherOpt(opt pubsub.PublisherOpt) fx.Option
- type ActuatorIn
- type ActuatorOut
- type App
- type ContextualHttpClientIn
- type ContextualHttpClientWrapper
- type EventBusIn
- type EventPublisherIn
- type Option
- type PropertiesLoaderIn
- type RegisterEventPublisherIn
- type ZapLoggerIn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActuatorEndpointOpt ¶
func HttpClientOpt ¶
func HttpRequestLogOpt ¶
func LoggingOpt ¶
func NewContextualHttpClient ¶
func NewContextualHttpClient(in ContextualHttpClientIn) (client.ContextualHttpClient, error)
NewContextualHttpClient Initiate a client.ContextualHttpClient with configs are loaded automatically. Alternatively you can wrap the default client.ContextualHttpClient with one or more other client.ContextualHttpClient to customize the behavior. To do that, your provider have to return ContextualHttpClientWrapper. For example https://gitlab.com/golibs-starter/golib-security/-/blob/develop/httpclient.go
func NewDefaultEventBus ¶
func NewDefaultEventBus(in EventBusIn) pubsub.EventBus
func NewDefaultEventPublisher ¶
func NewDefaultEventPublisher(in EventPublisherIn) pubsub.Publisher
func NewPropertiesLoader ¶
func NewPropertiesLoader(in PropertiesLoaderIn) (config.Loader, error)
func NewZapLogger ¶ added in v0.15.0
func NewZapLogger(in ZapLoggerIn) (log.Logger, error)
func OnStopEventOpt ¶
func PropertiesOpt ¶
func ProvideEventBusOpt ¶
func ProvideEventListener ¶
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 RegisterEventPublisher ¶
func RegisterEventPublisher(in RegisterEventPublisherIn)
func RegisterLogContextExtractor ¶ added in v0.15.0
func RegisterLogContextExtractor(extractor log.ContextExtractor) fx.Option
func RegisterLogger ¶
func RunEventBus ¶
func SupplyEventBusOpt ¶
func SupplyEventBusOpt(opt pubsub.EventBusOpt) fx.Option
func SupplyEventPublisherOpt ¶
func SupplyEventPublisherOpt(opt pubsub.PublisherOpt) fx.Option
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 ContextualHttpClientIn ¶
type ContextualHttpClientIn struct { fx.In AppProperties *config.AppProperties HttpClient client.HttpClient Wrappers []ContextualHttpClientWrapper `group:"contextual_http_client_wrapper"` }
type ContextualHttpClientWrapper ¶
type ContextualHttpClientWrapper func(client.ContextualHttpClient) (client.ContextualHttpClient, error)
type EventBusIn ¶
type EventBusIn struct { fx.In Options []pubsub.EventBusOpt `group:"event_bus_opt"` }
type EventPublisherIn ¶
type PropertiesLoaderIn ¶
type PropertiesLoaderIn struct { fx.In Properties []config.Properties `group:"properties"` Options []Option `group:"properties_option"` }
type ZapLoggerIn ¶ added in v0.15.0
type ZapLoggerIn struct { fx.In Props *log.Properties ContextExtractors []log.ContextExtractor `group:"log_context_extractor"` }