feat: 新增业务字段路径读写工具
新增 TakeBusinessFields、WriteBusinessFields、SetByPath 与 GetByPath 等工具,支持按映射路径写入请求体与解析响应,并更新相关依赖。
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package task
|
||||
|
||||
import "github.com/gogf/gf/v2/util/gconv"
|
||||
|
||||
var (
|
||||
StatusPending = newStatus(gconv.PtrInt8(1), "排队中") // 排队中
|
||||
StatusRunning = newStatus(gconv.PtrInt8(2), "执行中") // 执行中
|
||||
StatusSuccess = newStatus(gconv.PtrInt8(3), "成功") // 成功
|
||||
StatusFailed = newStatus(gconv.PtrInt8(4), "失败") // 失败
|
||||
StatusDownloaded = newStatus(gconv.PtrInt8(5), "已下载") // 已下载
|
||||
)
|
||||
|
||||
type Status *int8
|
||||
|
||||
type status struct {
|
||||
code Status
|
||||
desc string
|
||||
}
|
||||
|
||||
func (s status) Code() Status {
|
||||
return s.code
|
||||
}
|
||||
func (s status) Desc() string {
|
||||
return s.desc
|
||||
}
|
||||
|
||||
func newStatus(code Status, desc string) status {
|
||||
return status{code: code, desc: desc}
|
||||
}
|
||||
Reference in New Issue
Block a user