基础的插件注册+获取+调度能力, 待完善
This commit is contained in:
32
plugins/abstract/abstract.go
Normal file
32
plugins/abstract/abstract.go
Normal file
@ -0,0 +1,32 @@
|
||||
// Package abstract ...
|
||||
//
|
||||
// Description : plugins ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2024-11-13 16:21
|
||||
package abstract
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/gateway/core/define"
|
||||
)
|
||||
|
||||
// IPlugin 插件全局接口约束
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:22 2024/11/13
|
||||
type IPlugin interface {
|
||||
// ID 插件ID, 全局唯一, 不允许重复
|
||||
ID() string
|
||||
// Description 插件描述,描述插件的作用
|
||||
Description() string
|
||||
// Config 读取插件的配置
|
||||
Config() (map[string]any, error)
|
||||
// Allow 插件是否允许执行
|
||||
Allow() bool
|
||||
// SkipFailure 插件执行失败, 是否跳过
|
||||
SkipFailure() bool
|
||||
// Logic 插件执行的逻辑
|
||||
Logic(rc *define.RequestContext, cfg map[string]any) *define.PluginResult
|
||||
}
|
Reference in New Issue
Block a user