增加插件接口及插件结果定义

This commit is contained in:
2024-11-13 17:54:44 +08:00
parent 8022a8533f
commit 942cd1dfed
3 changed files with 78 additions and 7 deletions

30
plugins/abstract.go Normal file
View File

@ -0,0 +1,30 @@
// Package plugins ...
//
// Description : plugins ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-11-13 16:21
package plugins
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)
// SkipFailure 插件执行失败, 是否跳过
SkipFailure() bool
// Logic 插件执行的逻辑
Logic(rc *define.RequestContext) *define.PluginResult
}