crontab

package
v0.8.65 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Config

type Config struct {
	Jobs map[string]JobConfig `validate:"gt=0,dive,keys,required,endkeys,required"`
}

type Job

type Job func(context.Context) error

type JobConfig

type JobConfig struct {
	Schedule string        `validate:"cron"`
	Timeout  time.Duration `validate:"min=200ms"`
	Enabled  bool
}

type Scheduler

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

func (Scheduler) Run

func (s Scheduler) Run(_ context.Context) error

func (Scheduler) Validate

func (obj Scheduler) Validate() error

func (Scheduler) WaitForShutdown

func (s Scheduler) WaitForShutdown(ctx context.Context) error

type SchedulerOption

type SchedulerOption c.OptionWithContext[Scheduler]

func WithGocronOptions added in v0.8.7

func WithGocronOptions(opts ...gocron.SchedulerOption) SchedulerOption

func WithJob

func WithJob(jobName string, cfg JobConfig) SchedulerOption

func WithJobRegistry

func WithJobRegistry(jobs map[string]Job) SchedulerOption

func WithLogger

func WithLogger(logger *zap.Logger) SchedulerOption

func WithShutdownTimeout

func WithShutdownTimeout(t time.Duration) SchedulerOption

Jump to

Keyboard shortcuts

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