Documentation
¶
Overview ¶
Package app provides application root-path capability for gorp framework. Resolves base, storage, runtime, log, config, and temp directories from config and environment. Centralizes default path conventions behind one provider bound to contract.RootKey.
应用路径包提供应用根路径能力,用于 gorp 框架。 根据配置和环境变量解析 base、storage、runtime、log、config 和 temp 目录。 通过绑定到 contract.RootKey 的单一 provider 统一默认路径约定。
Eg:
// 注册 Provider app.Register(app.NewProvider()) // 获取路径服务 root := c.MustMake(runtimecontract.RootKey).(runtimecontract.Root) logPath := root.LogPath() configPath := root.ConfigPath()
Index ¶
Constants ¶
const AppKey = runtimecontract.RootKey
AppKey is the binding key used for the root-path capability.
AppKey 是根路径能力使用的绑定 key。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App interface {
runtimecontract.Root
}
App defines application path-related capabilities.
App 定义应用路径相关能力。
中文说明: - 继承 contract.Root 接口,提供统一的路径管理。 - 这是 “dedicated root contract 正式化” 的具体实现。 - 当前它更接近 runtime convention provider:提供 framework 默认业务起步路径所需的宿主目录约定。 - framework 现阶段先把它统一收进 `contract.RootKey` 语义,再继续观察是否需要进一步从 core provider 中下沉约定。
type Provider ¶
type Provider struct{}
Provider provides the root-path capability.
Provider 提供根路径能力。
func NewProvider ¶
func NewProvider() *Provider
NewProvider creates an app provider.
NewProvider 创建 app provider。
func (*Provider) Boot ¶
func (p *Provider) Boot(runtimecontract.Container) error
Boot does not require extra startup logic for the app provider.
Boot 表示 app provider 不需要额外启动逻辑。
func (*Provider) DependsOn ¶
DependsOn returns the keys this provider depends on. App provider optionally depends on Config for path configuration.
DependsOn 返回该 provider 依赖的 key。 App provider 可选依赖 Config 获取路径配置。
func (*Provider) IsDefer ¶
IsDefer reports that the app provider is not lazily loaded.
IsDefer 表示 app provider 不采用延迟加载。