scheduler

package
v0.0.0-...-541509d Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JobLoop

func JobLoop(schedule *Schedule)

func RunSchedule

func RunSchedule(schedule *Schedule, time Time)

Types

type Job

type Job struct {
	ID              string
	OnTrigger       TriggerCallback
	IntervalMinutes int
	NextTime        Time
}

func (*Job) String

func (job *Job) String() string

func (*Job) Trigger

func (job *Job) Trigger(time Time)

type Schedule

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

func NewSchedule

func NewSchedule() *Schedule

func (*Schedule) AddHourlyJob

func (s *Schedule) AddHourlyJob(id string, minute int, onTrigger TriggerCallback)

func (*Schedule) AddIntervalJob

func (s *Schedule) AddIntervalJob(id string, intervalMinutes int, offset int, onTrigger TriggerCallback)

func (*Schedule) GetJobsAt

func (s *Schedule) GetJobsAt(time Time) *list.List

func (*Schedule) Reschedule

func (s *Schedule) Reschedule(job Job)

type Time

type Time int

func (Time) AddMinutes

func (t Time) AddMinutes(minutes int) Time

func (Time) GetHour

func (t Time) GetHour() int

func (Time) GetMinute

func (t Time) GetMinute() int

func (Time) String

func (t Time) String() string

type TriggerCallback

type TriggerCallback = func(string, Time)

TriggerCallback receives the job ID, and the time when the job was triggered.

Jump to

Keyboard shortcuts

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