Ai
1 Star 0 Fork 0

袁飞煌/common_engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
command.go 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
袁飞煌 提交于 2022-05-08 13:48 +08:00 . feat(params_option): add multi params option
package common_engine
import "time"
type Command interface {
GetCommandParamsOptions() []CommandParamsOption
GetCommandText() string
GetPriority() float64
Handler(*TaskCommand, map[string]CommandResult) (interface{}, error)
GetCommandOption() *CommandOption
}
type CommandOption struct {
Timeout time.Duration
DelayTime time.Duration
RetryTime int
Must *bool // must need params option, nil: ignore ,true: need ,false don't need
StartRange int // specify params range, if StartRange equal 0,it will be ignore
ReferResult []string // refer other command handler result
FilterFunc Filter
}
func NewCommandOption() *CommandOption {
return &CommandOption{
Timeout: 2 * time.Second,
DelayTime: 0,
RetryTime: 0,
}
}
type ParamsType int64
const (
String ParamsType = 1
Int ParamsType = 2
Float ParamsType = 3
Json ParamsType = 4
Link ParamsType = 5
Number ParamsType = 6
File ParamsType = 7
Dir ParamsType = 8
)
type CommandParamsOption struct {
ParamsType ParamsType
Must bool
Multi bool // is multi params
MultiNum int
Suffix *string
Prefix *string
Include *string
Exclude *string
Priority int64
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/coder_vector/common_engine.git
git@gitee.com:coder_vector/common_engine.git
coder_vector
common_engine
common_engine
master

搜索帮助