timer

package module
v0.0.0-...-a1c38ff Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

README

timer

基于cron的定时器

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackJob

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

func NewCallbackJob

func NewCallbackJob(job cron.Job) (*CallbackJob, func(callback func()))

func (*CallbackJob) Run

func (j *CallbackJob) Run()

type Schedule

type Schedule struct {
	DoFirst bool
	// contains filtered or unexported fields
}

func NewSchedule

func NewSchedule(schedule cron.Schedule) Schedule

func (Schedule) Next

func (s Schedule) Next(t time.Time) time.Time

type TimedTask

type TimedTask struct {
	Id          int
	EntryId     cron.EntryID
	Prev        time.Time
	Next        time.Time
	Name        string
	Description string
}

type Timer

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

func NewTimer

func NewTimer() Timer

func (Timer) AddDisposableTask

func (timer Timer) AddDisposableTask(schedule Schedule, job cron.Job, name, description string) int

func (Timer) AddTask

func (timer Timer) AddTask(schedule Schedule, job cron.Job, name, description string) int

func (Timer) GetTask

func (timer Timer) GetTask(id int) TimedTask

func (Timer) GetTasks

func (timer Timer) GetTasks() []TimedTask

func (*Timer) Remove

func (timer *Timer) Remove(id int)

func (Timer) Run

func (timer Timer) Run()

func (Timer) Start

func (timer Timer) Start()

func (Timer) Stop

func (timer Timer) Stop()

Jump to

Keyboard shortcuts

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