Documentation ¶
Index ¶
- Constants
- func FormatDays(days []time.Time) []string
- func NewNamespace(name string) v1.Namespace
- func NewPod(namespace, name string, phase v1.PodPhase) v1.Pod
- func NewPodWithOwner(namespace, name string, phase v1.PodPhase, owner types.UID) v1.Pod
- func ParseDays(days string) ([]time.Time, error)
- func ParseWeekdays(weekdays string) []time.Weekday
- func RandomPodSubSlice(pods []v1.Pod, count int) []v1.Pod
- func TimeOfDay(pointInTime time.Time) time.Time
- type TimePeriod
Constants ¶
const ( // a short time format; like time.Kitchen but with 24-hour notation. Kitchen24 = "15:04" // a time format that just cares about the day and month. YearDay = "Jan_2" )
Variables ¶
This section is empty.
Functions ¶
func FormatDays ¶ added in v0.15.0
FormatDays takes a slice of times and returns a slice of strings in YearDate format (e.g. [Apr 1, Sep 24])
func NewNamespace ¶ added in v0.15.1
NewNamespace returns a new namespace instance for testing purposes.
func NewPodWithOwner ¶ added in v0.16.0
NewPodWithOwner returns a new pod instance for testing purposes with a given owner UID
func ParseWeekdays ¶ added in v0.7.0
ParseWeekdays takes a comma-separated list of abbreviated weekdays (e.g. sat,sun) and turns them into a slice of time.Weekday. It ignores any whitespace and any invalid weekdays.
func RandomPodSubSlice ¶ added in v0.16.0
RandomPodSubSlice creates a shuffled subslice of the give pods slice
Types ¶
type TimePeriod ¶ added in v0.8.0
TimePeriod represents a time period with a single beginning and end.
func NewTimePeriod ¶ added in v0.8.0
func NewTimePeriod(from, to time.Time) TimePeriod
NewTimePeriod returns a normalized TimePeriod given a start and end time.
func ParseTimePeriods ¶ added in v0.8.0
func ParseTimePeriods(timePeriods string) ([]TimePeriod, error)
ParseTimePeriods takes a comma-separated list of time periods in Kitchen24 format and turns them into a slice of TimePeriods. It ignores any whitespace.
func (TimePeriod) Includes ¶ added in v0.8.0
func (tp TimePeriod) Includes(pointInTime time.Time) bool
Includes returns true iff the given pointInTime's time of day is included in time period tp.
func (TimePeriod) String ¶ added in v0.8.0
func (tp TimePeriod) String() string
String returns tp as a pretty string.