cmdplugin

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirectories

func EnsureDirectories(config *PluginConfig) error

EnsureDirectories 确保插件系统所需的目录存在

func GetPluginApp

func GetPluginApp() *core.BaseApp

GetPluginApp 获取插件应用实例

func GetPluginCmd

func GetPluginCmd() *cobra.Command

GetPluginCmd 获取插件命令

func InitPluginCommands

func InitPluginCommands()

InitPluginCommands 初始化插件命令

func InitializePluginSystem

func InitializePluginSystem(repoManager *repo.RepositoryManager) error

InitializePluginSystem 初始化全局插件系统

func TriggerURLAdd

func TriggerURLAdd(url interface{}, data map[string]interface{})

TriggerURLAdd 触发 URL 添加事件

func TriggerUserLogin

func TriggerUserLogin(user interface{}, data map[string]interface{})

TriggerUserLogin 触发用户登录事件

func ValidatePluginConfig

func ValidatePluginConfig(config *PluginConfig) error

ValidatePluginConfig 验证插件配置

Types

type PendingRoute

type PendingRoute struct {
	Method  string
	Path    string
	Handler func() (interface{}, error)
}

PendingRoute 待注册的路由

type PluginConfig

type PluginConfig struct {
	// 是否启用插件系统
	Enabled bool `json:"enabled" env:"PLUGIN_ENABLED"`

	// 是否启用热重载
	HotReload bool `json:"hot_reload" env:"PLUGIN_HOT_RELOAD"`

	// 钩子目录
	HooksDir string `json:"hooks_dir" env:"PLUGIN_HOOKS_DIR"`

	// 迁移目录
	MigrationsDir string `json:"migrations_dir" env:"PLUGIN_MIGRATIONS_DIR"`

	// 类型定义目录
	TypesDir string `json:"types_dir" env:"PLUGIN_TYPES_DIR"`

	// VM 池大小
	VMPoolSize int `json:"vm_pool_size" env:"PLUGIN_VM_POOL_SIZE"`

	// 是否启用调试模式
	Debug bool `json:"debug" env:"PLUGIN_DEBUG"`
}

PluginConfig 插件系统配置

func LoadPluginConfig

func LoadPluginConfig() *PluginConfig

LoadPluginConfig 加载插件配置

type PluginConfigWrapper

type PluginConfigWrapper struct {
	// contains filtered or unexported fields
}

PluginConfigWrapper 配置包装器

func (*PluginConfigWrapper) Get

func (c *PluginConfigWrapper) Get(key string) interface{}

func (*PluginConfigWrapper) GetBool

func (c *PluginConfigWrapper) GetBool(key string) bool

func (*PluginConfigWrapper) GetInt

func (c *PluginConfigWrapper) GetInt(key string) int

func (*PluginConfigWrapper) GetString

func (c *PluginConfigWrapper) GetString(key string) string

func (*PluginConfigWrapper) Set

func (c *PluginConfigWrapper) Set(key string, value interface{})

type PluginIntegration

type PluginIntegration struct {
	// contains filtered or unexported fields
}

PluginIntegration 插件系统集成器

func GetGlobalPluginIntegration

func GetGlobalPluginIntegration() *PluginIntegration

GetGlobalPluginIntegration 获取全局插件系统集成实例

func NewPluginIntegration

func NewPluginIntegration(repoManager *repo.RepositoryManager) *PluginIntegration

NewPluginIntegration 创建插件系统集成器

func (*PluginIntegration) GetApp

func (pi *PluginIntegration) GetApp() *core.BaseApp

GetApp 获取插件应用实例

func (*PluginIntegration) GetPluginManager

func (pi *PluginIntegration) GetPluginManager() *plugin.Manager

GetPluginManager 获取插件管理器

func (*PluginIntegration) Initialize

func (pi *PluginIntegration) Initialize() error

Initialize 初始化插件系统

func (*PluginIntegration) SetRouter

func (pi *PluginIntegration) SetRouter(router *gin.Engine)

SetRouter 设置 Gin 路由器

type PluginLoggerWrapper

type PluginLoggerWrapper struct{}

PluginLoggerWrapper 日志包装器

func (*PluginLoggerWrapper) Debug

func (l *PluginLoggerWrapper) Debug(msg string, args ...interface{})

func (*PluginLoggerWrapper) Error

func (l *PluginLoggerWrapper) Error(msg string, args ...interface{})

func (*PluginLoggerWrapper) Fatal

func (l *PluginLoggerWrapper) Fatal(msg string, args ...interface{})

func (*PluginLoggerWrapper) Info

func (l *PluginLoggerWrapper) Info(msg string, args ...interface{})

func (*PluginLoggerWrapper) Warn

func (l *PluginLoggerWrapper) Warn(msg string, args ...interface{})

type PluginRouterWrapper

type PluginRouterWrapper struct{}

PluginRouterWrapper 路由包装器

func (*PluginRouterWrapper) DELETE

func (r *PluginRouterWrapper) DELETE(path string, handler interface{})

func (*PluginRouterWrapper) GET

func (r *PluginRouterWrapper) GET(path string, handler interface{})

func (*PluginRouterWrapper) Group

func (*PluginRouterWrapper) PATCH

func (r *PluginRouterWrapper) PATCH(path string, handler interface{})

func (*PluginRouterWrapper) POST

func (r *PluginRouterWrapper) POST(path string, handler interface{})

func (*PluginRouterWrapper) PUT

func (r *PluginRouterWrapper) PUT(path string, handler interface{})

func (*PluginRouterWrapper) Use

func (r *PluginRouterWrapper) Use(middleware interface{})

type PluginUtils

type PluginUtils struct{}

PluginUtils 插件系统工具函数

func NewPluginUtils

func NewPluginUtils() *PluginUtils

NewPluginUtils 创建插件工具实例

func (*PluginUtils) CreatePluginTemplate

func (p *PluginUtils) CreatePluginTemplate(pluginName, pluginType string) error

CreatePluginTemplate 创建插件模板文件

func (*PluginUtils) GetPluginStats

func (p *PluginUtils) GetPluginStats() map[string]interface{}

GetPluginStats 获取插件统计信息

func (*PluginUtils) ListPlugins

func (p *PluginUtils) ListPlugins() error

ListPlugins 列出所有插件文件

func (*PluginUtils) ValidatePlugin

func (p *PluginUtils) ValidatePlugin(filePath string) error

ValidatePlugin 验证插件文件

Jump to

Keyboard shortcuts

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