jobs

package
v0.0.0-...-d3539a1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJob

func AddJob(c *cron.Cron, job Job) (int, error)

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

func CallExec

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

func InitJob

func InitJob()

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

func Remove

func Remove(c *cron.Cron, entryID int) chan bool

Remove 移除任务

func Setup

func Setup(dbs map[string]*gorm.DB)

Setup 初始化

Types

type ExamplesOne

type ExamplesOne struct {
}

ExamplesOne 新添加的job 必须按照以下格式定义,并实现Exec函数

func (ExamplesOne) Exec

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

type ExecJob

type ExecJob struct {
	JobCore
}

func (*ExecJob) Run

func (e *ExecJob) Run()

type HttpJob

type HttpJob struct {
	JobCore
}

HttpJob 任务类型 http

func (*HttpJob) Run

func (h *HttpJob) Run()

Run http 任务接口

type Job

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

type JobCore

type JobCore struct {
	InvokeTarget   string
	Name           string
	JobId          int
	EntryId        int
	CronExpression string
	Args           string
}

type JobExec

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

Directories

Path Synopsis
dto

Jump to

Keyboard shortcuts

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