schedule

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	UpdateTime time.Time
	Key        string
	// contains filtered or unexported fields
}

Info holds metadata for a scheduled cron job.

type Schedule

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

Schedule manages cron jobs with key-based and ID-based lifecycle control.

func NewSchedule

func NewSchedule(opts ...cron.Option) *Schedule

NewSchedule creates a new Schedule with the given cron options.

func NewScheduleWithSeconds

func NewScheduleWithSeconds() *Schedule

NewScheduleWithSeconds creates a new Schedule that supports second-level cron granularity.

func (*Schedule) AddFunc

func (c *Schedule) AddFunc(spec string, cmd func(context2 *core.Context)) (cron.EntryID, error)

AddFunc adds a cron job that runs in the context's goroutine pool.

func (*Schedule) AddIdOrReplaceKeyFunc

func (c *Schedule) AddIdOrReplaceKeyFunc(id uint, key string, spec string, cmd func(context2 *core.Context)) (cron.EntryID, bool, error)

AddIdOrReplaceKeyFunc adds or replaces a cron job identified by a numeric ID.

func (*Schedule) AddKeyFunc

func (c *Schedule) AddKeyFunc(key string, spec string, cmd func(context2 *core.Context)) (cron.EntryID, bool, error)

AddKeyFunc adds a cron job if no job with the given key exists.

func (*Schedule) GetIds

func (c *Schedule) GetIds() []uint

GetIds returns all registered numeric IDs.

func (*Schedule) Init

func (c *Schedule) Init(ctx *core.Context) error

func (*Schedule) ReplaceKeyFunc

func (c *Schedule) ReplaceKeyFunc(key string, spec string, cmd func(context2 *core.Context)) (cron.EntryID, error)

ReplaceKeyFunc replaces a cron job identified by key with a new spec and command.

func (*Schedule) Run

func (c *Schedule) Run() error

func (*Schedule) StopIdFunc

func (c *Schedule) StopIdFunc(id uint)

StopIdFunc stops a cron job identified by its numeric ID.

func (*Schedule) StopKeyFunc

func (c *Schedule) StopKeyFunc(key string)

StopKeyFunc stops a cron job identified by its key.

Jump to

Keyboard shortcuts

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