Documentation ¶
Index ¶
- func Deduplicate(values []string) []string
- func DurationContaining(d time.Duration, t time.Time) (fromTime, toTime time.Time)
- type Job
- type Jobs
- func (jobs Jobs) AllStarts() startDurations
- func (jobs Jobs) CSV(w io.Writer) error
- func (jobs Jobs) IDs() []string
- func (jobs Jobs) ScheduleCSV(w io.Writer)
- func (jobs Jobs) ScheduleJobs()
- func (jobs Jobs) ScheduledStartRecords() [][]string
- func (jobs Jobs) StartingBetween(fromTime, toTime time.Time) Jobs
- func (jobs Jobs) StartingDuringDuration(t time.Time, d time.Duration) Jobs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Job ¶
type Job struct { // A unique identifier for the job that doesn't change often ID string // How often the job should be run; parsed from strings like "5m" "1h" // Should evenly divide the 24 hours in a day Frequency time.Duration // contains filtered or unexported fields }
A job that needs to be scheduled during the day
func (*Job) RunsPerDay ¶
Calculate the number of runs per day for a job
func (*Job) ScheduleJob ¶
func (j *Job) ScheduleJob()
Set job start times based upon ID hash and frequency
func (*Job) StartsBetween ¶
Determine whether a job is started between a range of times
func (Job) WithFrequency ¶
type Jobs ¶
type Jobs []Job
A slice of Jobs
func (Jobs) AllStarts ¶
func (jobs Jobs) AllStarts() startDurations
Return all start durations for a given set of Jobs
func (Jobs) ScheduleCSV ¶
Write CSV of Job start IDs and starts with one line per job start duration
func (Jobs) ScheduledStartRecords ¶
Returns a record for each start time of each Job
func (Jobs) StartingBetween ¶
Filter jobs to those that start between the given times
Click to show internal directories.
Click to hide internal directories.