scheduler

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

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

Go to latest
Published: Mar 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrScheduler = errScheduler{
	ErrInvalidMonths:  errors.New("invalid value in months, valid values are [1-12]"),
	ErrInvalidWeeks:   errors.New("invalid value in weeks, valid values are [1-5]"),
	ErrInvalidDays:    errors.New("invalid value in days, valid values are [0-6]"),
	ErrInvalidHours:   errors.New("invalid value in hours, valid values are [0-23]"),
	ErrInvalidMinutes: errors.New("invalid value in minutes, valid values are [0-59]"),
	ErrResolveMonth:   errors.New("unable to resolve target month"),
	ErrResolveWeek:    errors.New("unable to resolve target week"),
	ErrResolveDay:     errors.New("unable to resolve target day"),
	ErrResolveHour:    errors.New("unable to resolve target hour"),
	ErrResolveMinute:  errors.New("unable to resolve target minute"),
}

All errors that can be raised by scheduler

Functions

func SetNextTime

func SetNextTime(t *time.Time, scedule *Scedule) error

Set time of t to next occurence in schedule

func SleepFor

func SleepFor(msg string, dur time.Duration, interval time.Duration)

Sleep for dur and print time remaining every interval

Types

type Scedule

type Scedule struct {
	// Months of the year: 1 - 12
	Months []int

	// Weeks of the month: 1 - 5
	Weeks []int

	// Days of the week: 0 - 6 (Sunday first day of the week)
	Days []int

	// Hours of the day: 0 - 23
	Hours []int

	// Minutes of the hour: 0 - 59
	Minutes []int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳