Documentation
¶
Overview ¶
Package runtime implements the functions, types, and interfaces for the module.
Index ¶
- func ProvideDefaultRegistrar(rt Runtime) registry.Registrar
- func ProvideLogger(rt Runtime) log.Logger
- type AppInfo
- func (a AppInfo) GetEnv() string
- func (a AppInfo) GetID() string
- func (a AppInfo) GetName() string
- func (a AppInfo) GetStartTime() time.Time
- func (a AppInfo) GetUptime() time.Duration
- func (a AppInfo) GetVersion() string
- func (a AppInfo) IsValid() bool
- func (a AppInfo) Options() []kratos.Option
- func (a AppInfo) String() string
- func (a AppInfo) WithMetadata(key, value string) AppInfo
- type Runtime
- func (r *Runtime) AppInfo() *interfaces.AppInfo
- func (r *Runtime) Component(name string) (interface{}, bool)
- func (r *Runtime) Config() interfaces.Config
- func (r *Runtime) DefaultRegistrar() registry.Registrar
- func (r *Runtime) Discovery(name string) (registry.Discovery, bool)
- func (r *Runtime) Logger() log.Logger
- func (r *Runtime) NewApp(servers []transport.Server, appOptions ...kratos.Option) *kratos.App
- func (r *Runtime) Registrar(name string) (registry.Registrar, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvideDefaultRegistrar ¶ added in v0.2.6
ProvideDefaultRegistrar is a Wire provider function that extracts the default registrar from the Runtime 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 Runtime interface. It is intended to be used by the application's own Wire injector.
Types ¶
type AppInfo ¶ added in v0.2.6
type AppInfo interfaces.AppInfo
AppInfo represents the application's static, immutable identity information. It includes essential metadata such as the application's name, version, environment, and instance ID. This information is determined at startup and remains constant throughout the application's lifecycle.
func NewAppInfo ¶ added in v0.2.6
NewAppInfo creates a new AppInfo instance with default values for ID, StartTime, and Metadata. It requires the application's name, version, and environment.
func (AppInfo) GetEnv ¶ added in v0.2.6
GetEnv returns the environment the application is running in.
func (AppInfo) GetID ¶ added in v0.2.6
GetID returns the unique identifier of the application instance.
func (AppInfo) GetStartTime ¶ added in v0.2.6
GetStartTime returns the time the application was started.
func (AppInfo) GetUptime ¶ added in v0.2.6
GetUptime returns the duration since the application was started.
func (AppInfo) GetVersion ¶ added in v0.2.6
GetVersion returns the version of the application.
func (AppInfo) IsValid ¶ added in v0.2.6
IsValid checks if the AppInfo instance contains essential, non-empty identification fields.
func (AppInfo) Options ¶ added in v0.2.6
Options returns a slice of kratos.Option with the application's identity fields, suitable for passing to kratos.New().
func (AppInfo) String ¶ added in v0.2.6
String implements the fmt.Stringer interface for easy logging and identification. It returns a string in the format "name-version".
func (AppInfo) WithMetadata ¶ added in v0.2.6
WithMetadata returns a new AppInfo with the provided key-value pair added to the metadata. This method supports fluent chaining, e.g., appInfo.WithMetadata(...).WithMetadata(...)
type Runtime ¶ added in v0.1.15
type Runtime struct {
// contains filtered or unexported fields
}
Runtime defines the application's runtime environment, providing convenient access to core components. It encapsulates an interfaces.Container and is the primary object that applications will interact with.
func New ¶
func New(info *interfaces.AppInfo, container interfaces.Container, cfg interfaces.Config) *Runtime
New is the core constructor for a Runtime instance. It takes a fully initialized Container, Config, and aggregated options.Option.
func NewFromBootstrap ¶ added in v0.2.6
NewFromBootstrap is a convenience constructor that simplifies application startup. It encapsulates the entire process of calling bootstrap.New and then runtime.New. It accepts bootstrap.Option parameters directly, allowing the user to configure the bootstrap process.
func (*Runtime) AppInfo ¶ added in v0.2.6
func (r *Runtime) AppInfo() *interfaces.AppInfo
AppInfo returns the application's configured information (ID, name, version, metadata).
func (*Runtime) Component ¶ added in v0.2.6
Component retrieves a generic, user-defined component by its registered name.
func (*Runtime) Config ¶ added in v0.1.15
func (r *Runtime) Config() interfaces.Config
Config returns the configuration decoder, allowing access to raw configuration values.
func (*Runtime) DefaultRegistrar ¶ added in v0.2.6
DefaultRegistrar returns the default service registrar, used for service self-registration. It may be nil if no default registry is configured.
func (*Runtime) Discovery ¶ added in v0.2.6
Discovery returns a service discovery component by its configured name.
Directories
¶
| Path | Synopsis |
|---|---|
|
api
|
|
|
Package bootstrap implements the functions, types, and interfaces for the module.
|
Package bootstrap implements the functions, types, and interfaces for the module. |
|
Package config contains generated code by adptool.
|
Package config contains generated code by adptool. |
|
envsource
Package envsrouce implements the functions, types, and interfaces for the module.
|
Package envsrouce implements the functions, types, and interfaces for the module. |
|
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. |
|
Package context contains generated code by adptool.
|
Package context contains generated code by adptool. |
|
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. |
|
Package examples implements the functions, types, and interfaces for the module.
|
Package examples implements the functions, types, and interfaces for the module. |
|
configs/load_with_custom_parser
command
|
|
|
configs/load_with_interface
command
|
|
|
configs/load_with_runtime
command
|
|
|
storage
command
|
|
|
extension
|
|
|
database
Package database implements the functions, types, and interfaces for the module.
|
Package database implements the functions, types, and interfaces for the module. |
|
pagination
Package pagination implements the functions, types, and interfaces for the module.
|
Package pagination implements the functions, types, and interfaces for the module. |
|
security
Package security implements the functions, types, and interfaces for the module.
|
Package security implements the functions, types, and interfaces for the module. |
|
security/token
Package token provides token caching functionality for security module
|
Package token provides token caching functionality for security module |
|
storage
Package storage implements the functions, types, and interfaces for the module.
|
Package storage implements the functions, types, and interfaces for the module. |
|
storage/components/blob
Package blob implements the functions, types, and interfaces for the module.
|
Package blob implements the functions, types, and interfaces for the module. |
|
storage/components/layout
Package layout provides a generic interface for storage layouts.
|
Package layout provides a generic interface for storage layouts. |
|
storage/components/meta
Package meta implements the functions, types, and interfaces for the module.
|
Package meta 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 mail implements the functions, types, and interfaces for the module.
|
Package mail 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 optionutil provides utility functions for working with options.Context.
|
Package optionutil provides utility functions for working with options.Context. |
|
Package registry contains generated code by adptool.
|
Package registry contains generated code by adptool. |
|
Package service contains generated code by adptool.
|
Package service contains generated code by adptool. |
|
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. |
|
Package storage implements the functions, types, and interfaces for the module.
|
Package storage implements the functions, types, and interfaces for the module. |
|
filestore/meta
Package meta implements the functions, types, and interfaces for the module.
|
Package meta implements the functions, types, and interfaces for the module. |
|
filestore/meta/v1
Package metav1 implements the functions, types, and interfaces for the module.
|
Package metav1 implements the functions, types, and interfaces for the module. |
|
filestore/meta/v2
Package metav2 implements the functions, types, and interfaces for the module.
|
Package metav2 implements the functions, types, and interfaces for the module. |
|
test
|
|