Documentation
¶
Index ¶
- type Collections
- type Context
- type Injection
- type Life
- type LifeManager
- type Lifecycle
- type Module
- type ModuleBuilder
- func (inst *ModuleBuilder) Components(fn components.RegistryHandlerFunc) *ModuleBuilder
- func (inst *ModuleBuilder) Create() Module
- func (inst *ModuleBuilder) Depend(deps ...Module) *ModuleBuilder
- func (inst *ModuleBuilder) EmbedResources(fs embed.FS, basepath string) *ModuleBuilder
- func (inst *ModuleBuilder) Name(name string) *ModuleBuilder
- func (inst *ModuleBuilder) Revision(rev int) *ModuleBuilder
- func (inst *ModuleBuilder) Version(version string) *ModuleBuilder
- type OnCreateFunc
- type OnDestroyFunc
- type OnLoopFunc
- type OnStartFunc
- type OnStartPostFunc
- type OnStartPreFunc
- type OnStopFunc
- type OnStopPostFunc
- type OnStopPreFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collections ¶
type Collections struct {
Arguments arguments.Table
Attributes attributes.Table
Environment environment.Table
Parameters parameters.Table
Properties properties.Table
Resources resources.Table
}
Collections 持有上下文中的各种资源集合
func (*Collections) Complete ¶
func (inst *Collections) Complete(mode safe.Mode)
Complete 完善集合中的内容(如果需要)
type Context ¶
type Context interface {
io.Closer
context.Context
Mode() safe.Mode
NewChild() Context
NewInjection(scope components.Scope) Injection
GetArguments() arguments.Table
GetAttributes() attributes.Table
GetComponents() components.Table
GetEnvironment() environment.Table
GetProperties() properties.Table
GetResources() resources.Table
GetModules() []Module
GetMainModule() Module
GetLifeManager() LifeManager
SelectComponents(selector components.Selector) ([]any, error)
SelectComponent(selector components.Selector) (any, error)
GetComponent(id components.ID) (any, error)
ListComponentIDs() []components.ID
}
Context 表示一个 starter 应用上下文
type Injection ¶
type Injection interface {
components.Injection
Scope() components.Scope
Parent() Context
LifeManager() LifeManager
Complete() error
}
Injection 表示一个注入上下文
type Life ¶
type Life struct {
Order int // 表示初始化顺序, 值越大越靠后
OnCreate OnCreateFunc
OnStartPre OnStartPreFunc
OnStart OnStartFunc
OnStartPost OnStartPostFunc
OnLoop OnLoopFunc
OnStopPre OnStopPreFunc
OnStop OnStopFunc
OnStopPost OnStopPostFunc
OnDestroy OnDestroyFunc
}
Life ...
type Module ¶
type Module interface {
Name() string
Version() string
Revision() int
Dependencies() []Module
Resources() resources.Table
RegisterComponents(r components.Registry) error
}
Module 表示一个 Starter 模块
type ModuleBuilder ¶
type ModuleBuilder struct {
// contains filtered or unexported fields
}
ModuleBuilder 是用来创建模块的工具
func (*ModuleBuilder) Components ¶
func (inst *ModuleBuilder) Components(fn components.RegistryHandlerFunc) *ModuleBuilder
Components 用于设置组件注册函数
func (*ModuleBuilder) Depend ¶
func (inst *ModuleBuilder) Depend(deps ...Module) *ModuleBuilder
Depend 方法用来添加依赖项
func (*ModuleBuilder) EmbedResources ¶
func (inst *ModuleBuilder) EmbedResources(fs embed.FS, basepath string) *ModuleBuilder
EmbedResources 方法用来添加嵌入的资源
func (*ModuleBuilder) Name ¶
func (inst *ModuleBuilder) Name(name string) *ModuleBuilder
Name 方法用来设置模块名称
func (*ModuleBuilder) Revision ¶
func (inst *ModuleBuilder) Revision(rev int) *ModuleBuilder
Revision 方法用来设置模块的版本编号
func (*ModuleBuilder) Version ¶
func (inst *ModuleBuilder) Version(version string) *ModuleBuilder
Version 方法用来设置模块的版本号
Click to show internal directories.
Click to hide internal directories.