cronjob

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoItem = errors.New("key not found")
View Source
var ErrUnknownFormat = errors.New("unknown format")

Functions

This section is empty.

Types

type CronConfig

type CronConfig struct {
	EndTime    time.Time
	Expression string
	// contains filtered or unexported fields
}

func (CronConfig) Next

func (c CronConfig) Next(offset time.Time) time.Time

type CronItem

type CronItem[T any, K comparable] struct {
	// contains filtered or unexported fields
}

func (*CronItem[T, K]) Compare

func (node *CronItem[T, K]) Compare(that *CronItem[T, K]) int

func (*CronItem[T, K]) Value

func (node *CronItem[T, K]) Value() *T

type CronParser

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

func NewCronParser

func NewCronParser(loc *time.Location) *CronParser

func (CronParser) LocalTime

func (ts CronParser) LocalTime() time.Time

func (CronParser) LocalTimeString

func (ts CronParser) LocalTimeString(t time.Time) string

func (CronParser) Parse

func (ts CronParser) Parse(s string) (CronConfig, error)

type CronQueue

type CronQueue[T any, K comparable] struct {
	// contains filtered or unexported fields
}

func (*CronQueue[T, K]) DisplayAll

func (s *CronQueue[T, K]) DisplayAll()

func (*CronQueue[T, K]) Find

func (s *CronQueue[T, K]) Find(key K) (value T, nextSched time.Time, err error)

func (*CronQueue[T, K]) Insert

func (s *CronQueue[T, K]) Insert(sortKey time.Time, key K, value T)

func (*CronQueue[T, K]) IsEmpty

func (s *CronQueue[T, K]) IsEmpty() bool

func (*CronQueue[T, K]) NextSchedule

func (s *CronQueue[T, K]) NextSchedule() time.Time

func (*CronQueue[T, K]) Pop

func (s *CronQueue[T, K]) Pop() (T, error)

func (*CronQueue[T, K]) Remove

func (s *CronQueue[T, K]) Remove(key K) error

type Manager

type Manager[K comparable] struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager[K comparable](loc *time.Location) *Manager[K]

func (*Manager[K]) AddTask

func (s *Manager[K]) AddTask(config CronConfig, id K, job func())

func (*Manager[K]) FindTask

func (s *Manager[K]) FindTask(id K) (*Task[K], time.Time)

func (*Manager[K]) RemoveTasks

func (s *Manager[K]) RemoveTasks(ids ...K)

func (*Manager[K]) Run

func (s *Manager[K]) Run(ctx context.Context)

type Task

type Task[K comparable] struct {
	Config CronConfig
	ID     K
	Run    func()
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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