Documentation ¶
Overview ¶
Package cron 完成固定操作
Index ¶
Constants ¶
View Source
const ( // Stop 停止状态 Stop = iota // Pause 暂停状态 Pause // Running 正在运行状态 Running )
View Source
const (
TwoDay time.Duration = time.Hour * 24 * 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cron ¶
type Cron[T Channle] struct { Ch chan T // contains filtered or unexported fields }
Cron 管理所有任务,由 chan 传递数据 Enties([]Entity) <= Entity <= Tasker
type Daily ¶
type Daily struct { VideoAvID string // contains filtered or unexported fields }
Daily 日常任务
type Entities ¶
type Entities struct {
// contains filtered or unexported fields
}
Entities 保存所有 Entity 用于排序
type Entity ¶
type Entity struct { ID int64 Task Tasker // Prev 待执行时间 Prev time.Time // contains filtered or unexported fields }
Entity 保存下一次和这次的运行时间
type Info ¶
type Info struct { // ID uid 或 rid ID int64 // Type 动态类型 Type comment.Type // TimeCell 时间间隔 TimeCell time.Duration // Time 动态时间 Time int64 // Name 昵称 Name string }
Info 任务的信息
type Tasker ¶
type Tasker interface { // Run(chan<- interface{}, *sync.WaitGroup) Run() interface{} Next(time.Time) time.Time Info() Info }
Tasker 任务接口
Source Files ¶
Click to show internal directories.
Click to hide internal directories.