增加任务接口/配置/处理结果的定义

This commit is contained in:
2022-06-23 15:12:41 +08:00
parent 54bc83bd1f
commit bd9dce43c1
2 changed files with 64 additions and 0 deletions

38
define.go Normal file
View File

@ -0,0 +1,38 @@
// Package task ...
//
// Description : 定义任务配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2022-06-23 14:26
package task
// Config 任务配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 14:26 2022/6/23
type Config struct {
// GetRunID 获取任务运行的ID
GetRunID func() string
// Async 是否异步运行
Async bool
// Timeout 单位 : 秒, <= 0认为不设置超时
Timeout int
// ForbiddenCallback 禁用执行结果回调
ForbiddenCallback bool
}
// Result 执行结果
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 14:43 2022/6/23
type Result struct {
StartTime int64 // 开始时间, 纳秒
FinishTime int64 // 结束时间, 纳秒
Used int64 // 耗时, 纳秒
Param map[string]interface{} // 任务参数
Data map[string]interface{} // 任务结果数据
Err error // 异常信息, err == nil , 代表执行成功
}