schedule

package
v0.0.0-...-f4f8df4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DayOfWeekRepeater

type DayOfWeekRepeater struct {
	NumTimes int
	Days     []time.Weekday
}

DayOfWeekRepeater repeats the schedule NumTimes at the same time of day, but only on specified days of the week. NumTimes does not include the original schedule.

func (*DayOfWeekRepeater) Repeat

func (r *DayOfWeekRepeater) Repeat(s *Schedule) error

Repeat takes a Schedule and alters it to repeat ir.NumTimes times, repeating only on certain weekdays.

type IntervalRepeater

type IntervalRepeater struct {
	NumTimes int
	Interval time.Duration
}

IntervalRepeater repeats the schedule NumTimes with time between repeats of Interval. NumTimes does not include the original schedule.

func (*IntervalRepeater) Repeat

func (ir *IntervalRepeater) Repeat(s *Schedule) error

Repeat takes a Schedule object and alters it to repeat ir.NumTimes times at fixed intervals.

type Repeater

type Repeater interface {
	Repeat(schedule *Schedule) error
}

Repeater is an interface whose implementations define how to repeat a schedule. For example: a) Repeating at fixed intervals b) Repeating on certain days of the week

type Schedule

type Schedule struct {
	Schedule []time.Time
}

Schedule is the base struct representing a schedule

func NewSchedule

func NewSchedule(layout, value, location string) (*Schedule, error)

NewSchedule creates a Schedule object It will error if the required fields are improperly filled in.

func (*Schedule) CreateSchedule

func (s *Schedule) CreateSchedule(t ...time.Time)

CreateSchedule creates a Schedule

func (Schedule) Len

func (s Schedule) Len() int

Implementing the heap interface

func (Schedule) Less

func (s Schedule) Less(i, j int) bool

func (*Schedule) Next

func (s *Schedule) Next() time.Time

Next returns the next scheduled element

func (*Schedule) Pop

func (s *Schedule) Pop() interface{}

Pop is used make Schedule implement the heap interface

func (*Schedule) Push

func (s *Schedule) Push(x interface{})

Push is used make Schedule implement the heap interface

func (*Schedule) SetTime

func (s *Schedule) SetTime(layout, value, location string) error

SetTime parses a string input and sets the time for the event in the Schedule.

func (Schedule) Swap

func (s Schedule) Swap(i, j int)

Jump to

Keyboard shortcuts

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