Documentation ¶
Index ¶
- Variables
- func Install[T any](provider PluginProvider, plugin T, name ...string)
- func Uninstall(provider PluginProvider, name string)
- func UnsafePluginBundle(pluginBundle PluginBundle) _UnsafePluginBundledeprecated
- func Using[T any](provider PluginProvider, name string) T
- type PluginBundle
- type PluginInfo
- type PluginProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrPlugin = fmt.Errorf("%w: plugin", exception.ErrTiny) // 插件错误
)
Functions ¶
func UnsafePluginBundle
deprecated
func UnsafePluginBundle(pluginBundle PluginBundle) _UnsafePluginBundle
Deprecated: UnsafePluginBundle 访问插件包的内部方法
Types ¶
type PluginBundle ¶
type PluginBundle interface { PluginProvider // Install 安装插件,不设置插件名称时,将会使用插件实例名称作为插件名称 Install(pluginFace iface.FaceAny, name ...string) // Uninstall 卸载插件 Uninstall(name string) // Get 获取插件 Get(name string) (PluginInfo, bool) // Range 遍历所有已注册的插件 Range(fun generic.Func1[PluginInfo, bool]) // ReversedRange 反向遍历所有已注册的插件 ReversedRange(fun generic.Func1[PluginInfo, bool]) // contains filtered or unexported methods }
PluginBundle 插件包
type PluginInfo ¶
type PluginInfo struct { Name string // 插件名 Face iface.FaceAny // 插件Face Reflected reflect.Value // 插件反射值 Active bool // 是否激活 }
PluginInfo 插件信息
type PluginProvider ¶
type PluginProvider interface { // GetPluginBundle 获取插件包 GetPluginBundle() PluginBundle }
PluginProvider 插件提供者
Click to show internal directories.
Click to hide internal directories.