Documentation
¶
Index ¶
- func AddFlags(v *viper.Viper, f *pflag.FlagSet) error
- func Provide[T any](app *App, id string, constructor func() (T, error), opts ...ServiceOption) T
- type App
- func (app *App) Context(ctx context.Context) context.Context
- func (app *App) EnableHealthzEntrypoint()
- func (app *App) EnableMainEntrypoint()
- func (app *App) Error() error
- func (app *App) Provide(id string, constructor func() (any, error), opts ...ServiceOption) any
- func (app *App) Run(ctx context.Context) error
- func (app *App) Start(ctx context.Context) error
- func (app *App) Stop(ctx context.Context) error
- type Config
- type Option
- type ServiceError
- type ServiceOption
- type ServiceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) EnableHealthzEntrypoint ¶
func (app *App) EnableHealthzEntrypoint()
func (*App) EnableMainEntrypoint ¶
func (app *App) EnableMainEntrypoint()
type Config ¶
type Config struct { MainEntrypoint *kkrthttp.EntrypointConfig `key:"main-ep" env:"MAIN_EP" flag:"main-ep" desc:"main entrypoint: "` HealthzEntrypoint *kkrthttp.EntrypointConfig `key:"healthz-ep" env:"HEALTHZ_EP" flag:"healthz-ep" desc:"healthz entrypoint: "` Log *log.Config `key:"log"` StartTimeout *string `key:"start-timeout" env:"START_TIMEOUT" flag:"start-timeout" desc:"Start timeout"` StopTimeout *string `key:"stop-timeout" env:"STOP_TIMEOUT" flag:"stop-timeout" desc:"Stop timeout"` }
Config is the configuration for the application.
func DefaultConfig ¶ added in v0.3.5
func DefaultConfig() *Config
type Option ¶
func WithLogger ¶
WithLogger sets the logger of the application.
func WithVersion ¶
WithVersion sets the version of the application.
type ServiceError ¶
type ServiceError struct {
// contains filtered or unexported fields
}
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
type ServiceOption ¶
type ServiceOption func(*service) error
func WithComponentName ¶
func WithComponentName(name string) ServiceOption
WithComponentName sets the name of the component. Multiple services can have the same component name. By default, the component name is the name of the service identifier which is unique. This enables to override the default name (without unicity constraints)
func WithHealthConfig ¶
func WithHealthConfig(cfg *health.Config) ServiceOption
WithHealthConfig sets the health config of the service.
func WithTags ¶
func WithTags(tags ...*tag.Tag) ServiceOption
WithTags sets the tags of the service.
type ServiceStatus ¶
type ServiceStatus uint32
const ( Constructing ServiceStatus = iota Constructed Starting Running Stopping Stopped Error )
Click to show internal directories.
Click to hide internal directories.