Documentation
¶
Index ¶
- Variables
- type AppRegistry
- type Application
- func (app *Application) ConfigProvider() ConfigProvider
- func (app *Application) GetConfigSection(section string) (ConfigProvider, error)
- func (app *Application) GetService(name string, target any) error
- func (app *Application) Init() error
- func (app *Application) Logger() Logger
- func (app *Application) RegisterConfigSection(section string, cp ConfigProvider)
- func (app *Application) RegisterModule(module Module)
- func (app *Application) RegisterService(name string, service any) error
- func (app *Application) Run() error
- func (app *Application) Start() error
- func (app *Application) Stop() error
- func (app *Application) SvcRegistry() ServiceRegistry
- type ComplexFeeder
- type Config
- type ConfigProvider
- type ConfigSetup
- type Feeder
- type LoadAppConfigFunc
- type Logger
- type Module
- type ModuleConstructor
- type ModuleRegistry
- type ModuleWithConstructor
- type ServiceDependency
- type ServiceProvider
- type ServiceRegistry
- type StdConfigProvider
Constants ¶
This section is empty.
Variables ¶
var ConfigFeeders = []Feeder{ feeders.EnvFeeder{}, }
Functions ¶
This section is empty.
Types ¶
type AppRegistry ¶
type AppRegistry interface {
SvcRegistry() ServiceRegistry
}
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents the core Application container
func NewApplication ¶
func NewApplication(cp ConfigProvider, logger Logger) *Application
NewApplication creates a new application instance
func (*Application) ConfigProvider ¶
func (app *Application) ConfigProvider() ConfigProvider
ConfigProvider retrieves the application config provider
func (*Application) GetConfigSection ¶
func (app *Application) GetConfigSection(section string) (ConfigProvider, error)
GetConfigSection retrieves a configuration section
func (*Application) GetService ¶
func (app *Application) GetService(name string, target any) error
GetService retrieves a service with type assertion
func (*Application) Init ¶
func (app *Application) Init() error
Init initializes the application with the provided modules
func (*Application) RegisterConfigSection ¶
func (app *Application) RegisterConfigSection(section string, cp ConfigProvider)
RegisterConfigSection registers a configuration section with the application
func (*Application) RegisterModule ¶
func (app *Application) RegisterModule(module Module)
RegisterModule adds a module to the application
func (*Application) RegisterService ¶
func (app *Application) RegisterService(name string, service any) error
RegisterService adds a service with type checking
func (*Application) Run ¶
func (app *Application) Run() error
Run starts the application and blocks until termination
func (*Application) SvcRegistry ¶
func (app *Application) SvcRegistry() ServiceRegistry
SvcRegistry retrieves the service svcRegistry
type ComplexFeeder ¶
type Config ¶
func (*Config) AddStructKey ¶
type ConfigProvider ¶
type ConfigProvider interface {
GetConfig() any
}
type ConfigSetup ¶ added in v1.0.0
type ConfigSetup interface {
Setup() error
}
ConfigSetup is an interface that configs can implement to perform additional setup after being populated by feeders
type LoadAppConfigFunc ¶ added in v1.0.0
type LoadAppConfigFunc func(*Application) error
LoadAppConfigFunc is the function type for loading application configuration
var AppConfigLoader LoadAppConfigFunc = loadAppConfig
AppConfigLoader is the default implementation that can be replaced in tests
type Module ¶
type Module interface {
// RegisterConfig registers configuration requirements
RegisterConfig(app *Application)
// Init Initialize the module with the application context
Init(app *Application) error
// Start starts the module (non-blocking)
Start(ctx context.Context) error
// Stop gracefully stops the module
Stop(ctx context.Context) error
// Name returns the unique identifier for this module
Name() string
// Dependencies returns names of other modules this module depends on
Dependencies() []string
// ProvidesServices returns a list of services provided by this module
ProvidesServices() []ServiceProvider
// RequiresServices returns a list of services required by this module
RequiresServices() []ServiceDependency
}
Module represents a registrable component in the application
type ModuleConstructor ¶
type ModuleConstructor func(app *Application, services map[string]any) (Module, error)
type ModuleRegistry ¶
ModuleRegistry represents a svcRegistry of modules
type ModuleWithConstructor ¶
type ModuleWithConstructor interface {
Module
Constructor() ModuleConstructor
}
type ServiceDependency ¶
type ServiceDependency struct {
Name string
Required bool
Type reflect.Type // Concrete type (if known)
SatisfiesInterface reflect.Type // Interface type (if known)
}
ServiceDependency defines a dependency on a service
type ServiceProvider ¶ added in v1.0.0
ServiceProvider defines a service with metadata
type ServiceRegistry ¶
ServiceRegistry allows registration and retrieval of services
type StdConfigProvider ¶
type StdConfigProvider struct {
// contains filtered or unexported fields
}
func NewStdConfigProvider ¶
func NewStdConfigProvider(cfg any) *StdConfigProvider
func (*StdConfigProvider) GetConfig ¶
func (s *StdConfigProvider) GetConfig() any
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
modcli
module
|
|
|
modules
|
|
|
auth
module
|
|
|
cache
module
|
|
|
chimux
module
|
|
|
database
module
|
|
|
eventbus
module
|
|
|
eventlogger
module
|
|
|
httpclient
module
|
|
|
httpserver
module
|
|
|
jsonschema
module
|
|
|
letsencrypt
module
|
|
|
logmasker
module
|
|
|
reverseproxy
module
|
|
|
scheduler
module
|