cComponents

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 1 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultListenHandler added in v0.4.0

func DefaultListenHandler(config ConfigInterface)

func IsComponent added in v0.0.2

func IsComponent(instance interface{}) bool

func IsConf added in v0.4.0

func IsConf(instance any) bool

Types

type ComponentInterface added in v0.0.4

type ComponentInterface interface {
	Inject(instance any) bool               // 注入容器实例
	InjectConf(config ConfigInterface) bool // 注入组件配置
	Load()                                  // 初始化组件
	Listen() []*ConfigListener              // 监听配置
}

type ConfigInterface added in v0.4.0

type ConfigInterface interface {
	ConfigName() string
}

type ConfigListener added in v0.4.0

type ConfigListener struct {
	ConfigName string
	Listeners  []ListenHandler
}

type ContainerInterface added in v0.4.0

type ContainerInterface interface {
	Save(instance any) bool
	Get(name string) any
	Remove(name string) bool
	Is(instance any) bool
	Range(f func(instance any))
}

type ListenHandler added in v0.4.0

type ListenHandler func(config ConfigInterface)

Jump to

Keyboard shortcuts

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