Documentation
¶
Index ¶
- func ConvertToAppInfo(appConfig *appv1.App) interfaces.AppInfo
- func ProvideDefaultRegistrar(rt *App) (registry.Registrar, error)
- func ProvideLogger(rt *App) log.Logger
- type App
- func (r *App) AddComponentOptions(name string, opts ...options.Option)
- func (r *App) AddGlobalOptions(opts ...options.Option)
- func (r *App) AppInfo() interfaces.AppInfo
- func (r *App) CacheProvider() (container.CacheProvider, error)
- func (r *App) Component(name string) (interface{}, error)
- func (r *App) Config() interfaces.Config
- func (r *App) ConfigureCache(opts ...options.Option)
- func (r *App) ConfigureDatabase(opts ...options.Option)
- func (r *App) ConfigureMiddleware(opts ...options.Option)
- func (r *App) ConfigureObjectStore(opts ...options.Option)
- func (r *App) ConfigureRegistry(opts ...options.Option)
- func (r *App) Container() container.Container
- func (r *App) DatabaseProvider() (container.DatabaseProvider, error)
- func (r *App) DefaultRegistrar() (registry.Registrar, error)
- func (r *App) Load(path string, bootOpts ...bootstrap.Option) error
- func (r *App) Logger() log.Logger
- func (r *App) MiddlewareProvider() (container.MiddlewareProvider, error)
- func (r *App) NewApp(servers []transport.Server, options ...kratos.Option) *kratos.App
- func (r *App) ObjectStoreProvider() (container.ObjectStoreProvider, error)
- func (r *App) RegistryProvider() (container.RegistryProvider, error)
- func (r *App) StructuredConfig() interfaces.StructuredConfig
- func (r *App) WarmUp() error
- type AppInfo
- func (a *AppInfo) AddMetadata(key, value string) *AppInfo
- func (a *AppInfo) Env() string
- func (a *AppInfo) ID() string
- func (a *AppInfo) Merge(other interfaces.AppInfo)
- func (a *AppInfo) Metadata() map[string]string
- func (a *AppInfo) Name() string
- func (a *AppInfo) SetEnv(env string) *AppInfo
- func (a *AppInfo) SetID(id string) *AppInfo
- func (a *AppInfo) SetMetadata(metadata map[string]string) *AppInfo
- func (a *AppInfo) SetName(name string) *AppInfo
- func (a *AppInfo) SetNameAndVersion(name, version string) *AppInfo
- func (a *AppInfo) SetStartTime(startTime time.Time) *AppInfo
- func (a *AppInfo) SetVersion(version string) *AppInfo
- func (a *AppInfo) StartTime() time.Time
- func (a *AppInfo) Version() string
- type Option
- func WithAppInfo(info *AppInfo) Option
- func WithContainerOptions(opts ...options.Option) Option
- func WithEnv(env string) Option
- func WithID(id string) Option
- func WithMetadata(key, value string) Option
- func WithMetadataMap(metadata map[string]string) Option
- func WithStartTime(startTime time.Time) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToAppInfo ¶ added in v0.2.13
func ConvertToAppInfo(appConfig *appv1.App) interfaces.AppInfo
ConvertToAppInfo converts a protobuf App message to an interfaces.AppInfo.
func ProvideDefaultRegistrar ¶ added in v0.2.6
ProvideDefaultRegistrar is a Wire provider function that extracts the default registrar from the App interface. It is intended to be used by the application's own Wire injector.
func ProvideLogger ¶ added in v0.2.6
ProvideLogger is a Wire provider function that extracts the logger from the App interface. It is intended to be used by the application's own Wire injector.
Types ¶
type App ¶ added in v0.2.13
type App struct {
// contains filtered or unexported fields
}
App defines the application's runtime environment.
func New ¶
New is the primary and most common constructor for creating a new App instance. It requires the application name and version directly.
func NewWithOptions ¶ added in v0.2.14
NewWithOptions creates a new, partially initialized App instance using only functional options. This constructor provides maximum flexibility. It requires that the application's name and version be provided via options (e.g., by using WithAppInfo).
func (*App) AddComponentOptions ¶ added in v0.2.13
AddComponentOptions provides a generic way to add pre-configured options for any named component.
func (*App) AddGlobalOptions ¶ added in v0.2.13
AddGlobalOptions adds options that will be applied to all providers.
func (*App) AppInfo ¶ added in v0.2.13
func (r *App) AppInfo() interfaces.AppInfo
AppInfo returns the application's metadata as an interface.
func (*App) CacheProvider ¶ added in v0.2.13
func (r *App) CacheProvider() (container.CacheProvider, error)
CacheProvider returns the cache provider, using pre-configured options.
func (*App) Component ¶ added in v0.2.13
Component retrieves a generic, user-defined component by its registered name.
func (*App) Config ¶ added in v0.2.13
func (r *App) Config() interfaces.Config
Config returns the configuration decoder.
func (*App) ConfigureCache ¶ added in v0.2.13
ConfigureCache adds pre-configured options for the cache provider.
func (*App) ConfigureDatabase ¶ added in v0.2.13
ConfigureDatabase adds pre-configured options for the database provider.
func (*App) ConfigureMiddleware ¶ added in v0.2.13
ConfigureMiddleware adds pre-configured options for the middleware provider.
func (*App) ConfigureObjectStore ¶ added in v0.2.13
ConfigureObjectStore adds pre-configured options for the object store provider.
func (*App) ConfigureRegistry ¶ added in v0.2.13
ConfigureRegistry adds pre-configured options for the registry provider.
func (*App) Container ¶ added in v0.2.13
Container returns the underlying dependency injection container.
func (*App) DatabaseProvider ¶ added in v0.2.13
func (r *App) DatabaseProvider() (container.DatabaseProvider, error)
DatabaseProvider returns the database provider, using pre-configured options.
func (*App) DefaultRegistrar ¶ added in v0.2.13
DefaultRegistrar returns the default service registrar.
func (*App) Load ¶ added in v0.2.13
Load reads the configuration from the given path, completes the App initialization, and prepares it for running. It returns an error if the final application name or version is missing after merging all configurations.
func (*App) MiddlewareProvider ¶ added in v0.2.13
func (r *App) MiddlewareProvider() (container.MiddlewareProvider, error)
MiddlewareProvider returns the middleware provider, using pre-configured options.
func (*App) ObjectStoreProvider ¶ added in v0.2.13
func (r *App) ObjectStoreProvider() (container.ObjectStoreProvider, error)
ObjectStoreProvider returns the object store provider, using pre-configured options.
func (*App) RegistryProvider ¶ added in v0.2.13
func (r *App) RegistryProvider() (container.RegistryProvider, error)
RegistryProvider returns the service registry provider, using pre-configured options.
func (*App) StructuredConfig ¶ added in v0.2.13
func (r *App) StructuredConfig() interfaces.StructuredConfig
StructuredConfig returns the structured configuration decoder.
type AppInfo ¶ added in v0.2.6
type AppInfo struct {
// contains filtered or unexported fields
}
AppInfo is the concrete, exported implementation that satisfies the AppInfo interface.
func NewAppInfo ¶ added in v0.2.6
NewAppInfo is the primary constructor for creating a pre-configured AppInfo instance.
func NewAppInfoBuilder ¶ added in v0.2.14
func NewAppInfoBuilder() *AppInfo
NewAppInfoBuilder returns a new, blank AppInfo instance, serving as the entry point for chainable method configurations.
func (*AppInfo) AddMetadata ¶ added in v0.2.14
AddMetadata adds a single key-value pair to the application's metadata.
func (*AppInfo) Merge ¶ added in v0.2.14
func (a *AppInfo) Merge(other interfaces.AppInfo)
Merge combines the current AppInfo with another interfaces.AppInfo. Values from the 'other' AppInfo will override the current AppInfo's values if they are not empty or zero.
func (*AppInfo) Metadata ¶ added in v0.2.14
Metadata returns a defensive copy of the metadata map to ensure immutability.
func (*AppInfo) SetMetadata ¶ added in v0.2.14
SetMetadata completely replaces the application's metadata with the provided map.
func (*AppInfo) SetNameAndVersion ¶ added in v0.2.14
SetNameAndVersion sets both the application name and version.
func (*AppInfo) SetStartTime ¶ added in v0.2.14
SetStartTime sets the application start time.
func (*AppInfo) SetVersion ¶ added in v0.2.14
SetVersion sets the application version.
type Option ¶ added in v0.2.0
type Option func(*App)
Option is a functional option for configuring the App. It allows for applying configurations to the App instance at creation time.
func WithAppInfo ¶ added in v0.2.7
WithAppInfo sets the App's AppInfo using a concrete *AppInfo instance. This option has priority over the name and version parameters in New().
func WithContainerOptions ¶ added in v0.2.13
WithContainerOptions adds options that will be applied to the dependency injection container. These options are collected during the New() phase and applied during the Load() phase when the container is created.
func WithMetadata ¶ added in v0.2.13
WithMetadata adds a key-value pair to the application's metadata.
func WithMetadataMap ¶ added in v0.2.13
WithMetadataMap adds a map of key-value pairs to the application's metadata.
func WithStartTime ¶ added in v0.2.13
WithStartTime sets a custom start time.
Directories
¶
| Path | Synopsis |
|---|---|
|
api
|
|
|
Package config contains generated code by adptool.
|
Package config contains generated code by adptool. |
|
envsource
Package envsource is a configuration source that loads environment variables.
|
Package envsource is a configuration source that loads environment variables. |
|
file
Package file implements the functions, types, and interfaces for the module.
|
Package file implements the functions, types, and interfaces for the module. |
|
internal/reflection
Package reflection implements the functions, types, and interfaces for the module.
|
Package reflection implements the functions, types, and interfaces for the module. |
|
protoutil
Package protoutil provides utility functions for working with protobuf Any messages.
|
Package protoutil provides utility functions for working with protobuf Any messages. |
|
internal/util
Package util implements the functions, types, and interfaces for the module.
|
Package util implements the functions, types, and interfaces for the module. |
|
Package context contains generated code by adptool.
|
Package context contains generated code by adptool. |
|
data
|
|
|
storage
Package storage provides a unified interface for various storage solutions including cache, database, and file storage.
|
Package storage provides a unified interface for various storage solutions including cache, database, and file storage. |
|
storage/cache
Package cache provides a factory function to create Cache instances.
|
Package cache provides a factory function to create Cache instances. |
|
storage/database
Package database implements the functions, types, and interfaces for the module.
|
Package database implements the functions, types, and interfaces for the module. |
|
storage/objectstore
Package objectstore provides a factory function to create ObjectStore instances.
|
Package objectstore provides a factory function to create ObjectStore instances. |
|
Package errors provides enhanced error handling with module support, error codes, and metadata.
|
Package errors provides enhanced error handling with module support, error codes, and metadata. |
|
examples
|
|
|
configs/bootstrap_sample
command
|
|
|
configs/load_with_custom_parser
command
|
|
|
configs/load_with_interface
command
|
|
|
configs/load_with_runtime
command
|
|
|
storage
command
|
|
|
extensions
|
|
|
optionutil
Package optionutil provides utility functions for working with options.Context.
|
Package optionutil provides utility functions for working with options.Context. |
|
constant
Package constant defines the constant keys for structured configuration components.
|
Package constant defines the constant keys for structured configuration components. |
|
storage
Package storage defines the interfaces for storage services.
|
Package storage defines the interfaces for storage services. |
|
storage/database
Package database implements the functions, types, and interfaces for the module.
|
Package database implements the functions, types, and interfaces for the module. |
|
internal
|
|
|
factory
Package factory implements the functions, types, and interfaces for the module.
|
Package factory implements the functions, types, and interfaces for the module. |
|
Package log implements the functions, types, and interfaces for the module.
|
Package log implements the functions, types, and interfaces for the module. |
|
Package middleware implements the functions, types, and interfaces for the module.
|
Package middleware implements the functions, types, and interfaces for the module. |
|
cors
Package cors implements CORS middleware for the framework.
|
Package cors implements CORS middleware for the framework. |
|
validate
Package validate implements the functions, types, and interfaces for the module.
|
Package validate implements the functions, types, and interfaces for the module. |
|
Package registry implements the functions, types, and interfaces for the module.
|
Package registry implements the functions, types, and interfaces for the module. |
|
Package service implements the functions, types, and interfaces for the module.
|
Package service implements the functions, types, and interfaces for the module. |
|
selector
Package selector contains generated code by adptool.
|
Package selector contains generated code by adptool. |
|
tls
Package tls implements the functions, types, and interfaces for the module.
|
Package tls implements the functions, types, and interfaces for the module. |
|
transport
Package transport contains generated code by adptool.
|
Package transport contains generated code by adptool. |
|
test
|
|