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

41 lines
709 B
Go
Raw Permalink Normal View History

2025-01-06 16:01:02 +08:00
package coroutine_timer
// timerObj
// @description: 定时调度对象
type timerObj struct {
// id 调度id
id string
// tick 执行时间
tick int64
// excuteAction 执行方法
excuteAction func(interface{})
// paramObj 携带的参数
paramObj interface{}
// needCheckId 是否需要校验id
needCheckId bool
}
// newTimerObj
// @description: 构造调度对象
// parameter:
// @_id:id
// @t:调度时间
// @ea:调度方法
// @pm:调度参数
// return:
// @*timerObj:
func newTimerObj(_id string, t int64, ea func(interface{}), pm interface{}) *timerObj {
result := &timerObj{
id: _id,
tick: t,
excuteAction: ea,
paramObj: pm,
}
return result
}