application

package module
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 11 Imported by: 258

README

application

the go module "github.com/starter-go/application"

Documentation

Index

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 LifeManager

type LifeManager interface {
	Add(l *Life)

	GetMaster() *Life
}

LifeManager ...

type Lifecycle

type Lifecycle interface {
	Life() *Life
}

Lifecycle ...

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

Components 用于设置组件注册函数

func (*ModuleBuilder) Create

func (inst *ModuleBuilder) Create() Module

Create 创建模块

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 方法用来设置模块的版本号

type OnCreateFunc

type OnCreateFunc func() error

OnCreateFunc ...

type OnDestroyFunc

type OnDestroyFunc func() error

OnDestroyFunc ...

type OnLoopFunc

type OnLoopFunc func() error

OnLoopFunc ...

type OnStartFunc

type OnStartFunc func() error

OnStartFunc ...

type OnStartPostFunc

type OnStartPostFunc func() error

OnStartPostFunc ...

type OnStartPreFunc

type OnStartPreFunc func() error

OnStartPreFunc ...

type OnStopFunc

type OnStopFunc func() error

OnStopFunc ...

type OnStopPostFunc

type OnStopPostFunc func() error

OnStopPostFunc ...

type OnStopPreFunc

type OnStopPreFunc func() error

OnStopPreFunc ...

Directories

Path Synopsis
src
demo command
main/golang command

Jump to

Keyboard shortcuts

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