app

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 4 Imported by: 0

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

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

Boot does not require extra startup logic for the app provider.

Boot 表示 app provider 不需要额外启动逻辑。

func (*Provider) DependsOn

func (p *Provider) DependsOn() []string

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

func (p *Provider) IsDefer() bool

IsDefer reports that the app provider is not lazily loaded.

IsDefer 表示 app provider 不采用延迟加载。

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

Name 返回 provider 名称。

func (*Provider) Provides

func (p *Provider) Provides() []string

Provides returns the capability keys exposed by the app provider.

Provides 返回 app provider 暴露的能力 key。

func (*Provider) Register

func (p *Provider) Register(c runtimecontract.Container) error

Register binds the application path service into the container.

Register 将应用路径服务绑定到容器。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL