Documentation
¶
Index ¶
- func ConvertToAppInfo(appConfig *appv1.App) interfaces.AppInfo
- func NewAppInfo(name, version string, opts ...AppInfoOption) 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 AppInfoOption
- func WithAppInfoEnv(env string) AppInfoOption
- func WithAppInfoID(id string) AppInfoOption
- func WithAppInfoMetadata(key, value string) AppInfoOption
- func WithAppInfoMetadataMap(metadata map[string]string) AppInfoOption
- func WithAppInfoName(name string) AppInfoOption
- func WithAppInfoStartTime(startTime time.Time) AppInfoOption
- func WithAppInfoVersion(version string) AppInfoOption
- type Option
- func WithAppInfo(info interfaces.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 NewAppInfo ¶ added in v0.2.6
func NewAppInfo(name, version string, opts ...AppInfoOption) interfaces.AppInfo
NewAppInfo is the public constructor that returns an interfaces.AppInfo. It acts as a wrapper around the internal newAppInfo, hiding the concrete implementation from the outside world.
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 creates a new, partially initialized App instance with essential metadata and container configurations. It accepts functional options to allow for pre-configuring the container. The App is not fully functional until Load is called.
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.
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 AppInfoOption ¶ added in v0.2.13
type AppInfoOption func(a *appInfo)
AppInfoOption is a functional option for configuring the AppInfo. It allows for applying configurations to the appInfo instance at creation time.
func WithAppInfoEnv ¶ added in v0.2.13
func WithAppInfoEnv(env string) AppInfoOption
WithAppInfoEnv sets the application environment.
func WithAppInfoID ¶ added in v0.2.13
func WithAppInfoID(id string) AppInfoOption
WithAppInfoID sets the application ID.
func WithAppInfoMetadata ¶ added in v0.2.13
func WithAppInfoMetadata(key, value string) AppInfoOption
WithAppInfoMetadata adds a key-value pair to the application's metadata.
func WithAppInfoMetadataMap ¶ added in v0.2.13
func WithAppInfoMetadataMap(metadata map[string]string) AppInfoOption
WithAppInfoMetadataMap adds a map of key-value pairs
func WithAppInfoName ¶ added in v0.2.13
func WithAppInfoName(name string) AppInfoOption
WithAppInfoName sets the application name.
func WithAppInfoStartTime ¶ added in v0.2.13
func WithAppInfoStartTime(startTime time.Time) AppInfoOption
WithAppInfoStartTime sets the application start time.
func WithAppInfoVersion ¶ added in v0.2.13
func WithAppInfoVersion(version string) AppInfoOption
WithAppInfoVersion 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
func WithAppInfo(info interfaces.AppInfo) Option
WithAppInfo merges the provided interfaces.AppInfo into the App's internal appInfo.
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 service contains generated code by adptool.
|
Package service contains generated code by adptool. |
|
test
|
|