cron

package
v0.0.0-...-b58a2f6 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIsRunning ...
	ErrIsRunning = errors.New("cron is running")
)

Functions

This section is empty.

Types

type Cron

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

Cron ...

func New

func New() *Cron

New ...

func (*Cron) AddTask

func (c *Cron) AddTask(name string, f TaskFunc)

AddTask ...

func (*Cron) Run

func (c *Cron) Run()

Run start cron

func (*Cron) SetInterval

func (c *Cron) SetInterval(i time.Duration)

SetInterval 设置cron任务执行间隔,不设置则使用默认值defaultInterval

func (*Cron) SetLogErrorFunc

func (c *Cron) SetLogErrorFunc(f LogFunc)

SetLogErrorFunc 设置输出错误日志的方法

func (*Cron) SetLogFunc

func (c *Cron) SetLogFunc(f LogFunc)

SetLogFunc 设置输出普通日志的方法

func (*Cron) SetNewCtxFunc

func (c *Cron) SetNewCtxFunc(f NewContextFunc)

SetNewCtxFunc 创建新context的方法

func (*Cron) Stop

func (c *Cron) Stop(somethings ...interface{})

Stop stop cron

type LogFunc

type LogFunc func(ctx context.Context, args ...interface{})

LogFunc ...

type NewContextFunc

type NewContextFunc func(ctx context.Context) context.Context

NewContextFunc ...

type TaskFunc

type TaskFunc func(ctx context.Context) error

TaskFunc func

Jump to

Keyboard shortcuts

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