fixed

package
v0.0.0-...-c8d982f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func DayStrings

func DayStrings() []string

DayStrings returns a slice of all String values of the enum

Types

type Day

type Day int
const (
	Sunday Day = iota
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

func DayString

func DayString(s string) (Day, error)

DayString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func DayValues

func DayValues() []Day

DayValues returns all values of the enum

func ParseDay

func ParseDay(s string) (Day, error)

ParseDay parses a single day

func ParseDays

func ParseDays(s string) ([]Day, error)

ParseDays converts a days string into a slice of individual days Days format:

day[-day][, ...]

func (Day) IsADay

func (i Day) IsADay() bool

IsADay returns "true" if the value is listed in the enum definition. "false" otherwise

func (Day) String

func (i Day) String() string

type HourMin

type HourMin struct {
	Hour, Min int
}

func (HourMin) IsNil

func (hm HourMin) IsNil() bool

func (HourMin) Minutes

func (hm HourMin) Minutes() int

func (HourMin) String

func (hm HourMin) String() string

type TimeRange

type TimeRange struct {
	From, To HourMin
}

func ParseTimeRange

func ParseTimeRange(s string) (TimeRange, error)

func ParseTimeRanges

func ParseTimeRanges(s string) ([]TimeRange, error)

func (TimeRange) Contains

func (tr TimeRange) Contains(hm HourMin) bool

func (TimeRange) IsNil

func (tr TimeRange) IsNil() bool

func (TimeRange) String

func (tr TimeRange) String() string

type Zone

type Zone struct {
	Price float64
	Days  []Day
	Hours TimeRange
}

type Zones

type Zones []Zone

func (Zones) ForDay

func (r Zones) ForDay(day Day) Zones

ForDay returns the zones for given day in ascending order

func (Zones) Len

func (r Zones) Len() int

implement sort.Interface

func (Zones) Less

func (r Zones) Less(i, j int) bool

func (Zones) Swap

func (r Zones) Swap(i, j int)

func (Zones) TimeTableMarkers

func (r Zones) TimeTableMarkers() []HourMin

TimeTableMarkers returns list of zone start/end markers

Jump to

Keyboard shortcuts

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