timeband

package
v0.0.0-...-13f918f Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Day

type Day string

Day represents a day of the week - MON through SUN

func (Day) MatchesDow

func (d Day) MatchesDow(t time.Time) bool

MatchesDow tests if the day-of-week of the supplied time falls on this day

func (Day) String

func (d Day) String() string

String satisfies Stringer

func (*Day) UnmarshalJSON

func (d *Day) UnmarshalJSON(b []byte) error

UnmarshalJSON satisifies the JSON unmarshaler interface in order to interpret "MON" (or "mon" or "Mon") to "SUN" json

func (Day) Weekday

func (d Day) Weekday() time.Weekday

Weekday returns as time.Weekday

type Days

type Days []Day

Days represents a number of days

func (Days) MatchesDow

func (days Days) MatchesDow(t time.Time) bool

MatchesDow tests if the day-of-week of the supplied time falls within any day

type Time

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

Time represents a time in HH:MM:SS format

func TimeFromTime

func TimeFromTime(t time.Time) *Time

TimeFromTime mints a new Time object (representing JUST the time component) from a golang time (representing a point in time)

func (*Time) Gte

func (t *Time) Gte(u *Time) bool

Gte tests t is greater than or equal to u (same time or later than it)

func (*Time) Lte

func (t *Time) Lte(u *Time) bool

Lte tests t is less than or equal to u (same time or earlier than it)

func (*Time) String

func (t *Time) String() string

String satisifes Stringer

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON satisifies the JSON unmarshaler interface in order to interpret "HH:MM" or "HH:MM:SS" json

type TimeBand

type TimeBand struct {
	StartTime Time `json:"startTime" schema-type:"string"`
	EndTime   Time `json:"endTime" schema-type:"string"`
	Days      Days `json:"days" format:"table"`
}

TimeBand represents a time range, on a repeating number of days

func (*TimeBand) Spans

func (tb *TimeBand) Spans(t time.Time) bool

Spans tests whether a day and time, as extracted from t, are within this band We are only checking here on day of week and time

type TimeBands

type TimeBands []*TimeBand

TimeBands represents a collection of time bands

func (TimeBands) Spans

func (tbs TimeBands) Spans(t time.Time) bool

Spans tests whether a day and time, as extracted from t, are within ANY band

Jump to

Keyboard shortcuts

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