goProject/trunk/goutil/coroutine-timer/cmd.go

48 lines
696 B
Go
Raw Permalink Normal View History

2025-01-06 16:01:02 +08:00
package coroutine_timer
const (
// 添加
cmd_add = 1
// 删除
cmd_del = 2
)
// cmdModel
// @description: 命令对象
type cmdModel struct {
// cmd 指令
cmd int
// paramObj 指令参数
paramObj interface{}
// resObj 指令返回对象
resObj interface{}
// err 指令返回的错误
err error
// waitChan 等待channel
waitChan chan struct{}
}
// newCmdModel
// @description: 创建cmd模型对象
// parameter:
// @c:cmd命令
// @po:参数
// return:
// @*cmdModel:
func newCmdModel(c int, po interface{}) *cmdModel {
result := &cmdModel{
cmd: c,
paramObj: po,
resObj: nil,
err: nil,
waitChan: make(chan struct{}, 1),
}
return result
}