Documentation
¶
Overview ¶
Package dependency 依赖管理,可以保证各个模块能按顺序初始化依赖项。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct {
// contains filtered or unexported fields
}
Dependency 模块管理工具,管理模块的初始化顺序
func (*Dependency) Add ¶
func (dep *Dependency) Add(name string, init InitFunc, deps ...string) error
Add 添加一个新的模块。
name 为模块的名称; init 为模块的初始化函数; deps 为模块的依赖模块,依赖模块可以后于当前模块注册,但必须要存在。
func (*Dependency) Init ¶
func (dep *Dependency) Init() error
Init 对所有的模块进行初始化操作,会进行依赖检测。 若模块初始化出错,则会中断并返回出错信息。
Click to show internal directories.
Click to hide internal directories.