sched

package
v1.2.1-sp1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sched

type Sched struct {
	// contains filtered or unexported fields
}

func (*Sched) Feed

func (s *Sched) Feed(t *Task) error

func (*Sched) ForeachTask

func (s *Sched) ForeachTask(f func(task *Task) bool)

func (*Sched) GetTaskByID

func (s *Sched) GetTaskByID(id string) (*Task, error)

type Task

type Task struct {

	// 任务 ID
	ID string

	// 任务的启动时间
	Start time.Time

	// 任务的停止时间
	End time.Time
	// contains filtered or unexported fields
}

func NewTask

func NewTask(interval time.Duration, id string, start, end time.Time, f func(), first bool) *Task

func (*Task) Cancel

func (t *Task) Cancel()

func (*Task) Execute

func (t *Task) Execute() error

func (*Task) ExecuteWithContext

func (t *Task) ExecuteWithContext(ctx context.Context) error

func (*Task) GetIntervalSeconds

func (t *Task) GetIntervalSeconds() int64

func (*Task) IsDisabled

func (t *Task) IsDisabled() bool

func (*Task) IsExecuted

func (t *Task) IsExecuted() bool

func (*Task) IsFinished

func (t *Task) IsFinished() bool

状态函数

func (*Task) IsInScheduling

func (t *Task) IsInScheduling() bool

func (*Task) IsWorking

func (t *Task) IsWorking() bool

func (*Task) JustExecuteNotRecording

func (t *Task) JustExecuteNotRecording()

func (*Task) LastExecutedDate

func (t *Task) LastExecutedDate() (time.Time, error)

其他参数

func (*Task) NextExecuteDate

func (t *Task) NextExecuteDate() (time.Time, error)

func (*Task) OnBeforeExecuting

func (t *Task) OnBeforeExecuting(tag string, callback TaskCallback) error

func (*Task) OnCanceled

func (t *Task) OnCanceled(tag string, callback TaskCallback) error

func (*Task) OnEveryExecuted

func (t *Task) OnEveryExecuted(tag string, callback TaskCallback) error

func (*Task) OnFinished

func (t *Task) OnFinished(tag string, callback TaskCallback) error

func (*Task) OnScheduleStart

func (t *Task) OnScheduleStart(tag string, callback TaskCallback) error

func (*Task) SetDisabled

func (t *Task) SetDisabled(b bool)

type TaskCallback

type TaskCallback func(t *Task)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL