scheduled

package
v2.0.77 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GCron *cron.Cron

GCron 全局定时任务

Functions

func AddJob

func AddJob(s Scheduled) (int, error)

AddJob 添加任务 AddJob(invokeTarget string, jobId int, jobName string, cronExpression string)

func CallExec

func CallExec(e JobExec, arg interface{}) error

CallExec CallExec

func InitCron

func InitCron()

InitCron 初始化定时任务

func InitJob

func InitJob()

需要将定义的struct 添加到字典中; 字典 key 可以配置到自动任务调用目标中;

func NewWithSeconds

func NewWithSeconds() *cron.Cron

NewWithSeconds returns a Cron with the seconds field enabled.

func RegisterExec

func RegisterExec(jobName string, e JobExec)

RegisterExec 注册执行函数,名称不能重复。

jobName: 注册的任务名称
e: 具体的任务执行对象

func Remove

func Remove(entryID int) chan bool

Remove 移除任务

func Stop

func Stop() chan bool

Stop 任务停止

Types

type ExamplesOne

type ExamplesOne struct {
}

ExamplesOne 任务结构体

func (ExamplesOne) Exec

func (t ExamplesOne) Exec(arg interface{}) error

Exec 执行方法

type ExecJob

type ExecJob struct {
	Job
}

ExecJob 执行任务

func (*ExecJob) Run

func (e *ExecJob) Run()

Run 执行

type HTTPJob

type HTTPJob struct {
	Job
}

HTTPJob Http任务

func (*HTTPJob) Run

func (h *HTTPJob) Run()

Run 执行任务

type Job

type Job struct {
	InvokeTarget   string
	Name           string
	JobID          uint
	EntryID        int
	CronExpression string
	Args           string
}

Job 定时任务

type JobExec

type JobExec interface {
	Exec(arg interface{}) error
}

JobExec 任务执行

type Scheduled

type Scheduled interface {
	Run()
	// contains filtered or unexported methods
}

Scheduled 定时任务

Jump to

Keyboard shortcuts

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