Documentation ¶
Index ¶
- Constants
- func ParseDate(date string, location *time.Location) (t time.Time, err error)
- func ParseTimeClock(cc *CalendarConfig) (tc *timeClock, err error)
- func ParseTimeOfDay(tod string) (t time.Time, err error)
- type Calendar
- type CalendarConfig
- type DB
- type DatePeriod
- type DateRangeConfig
- type Device
- type DeviceIP
- type TimeOfDayPeriod
- type TimeOfDayPeriodConfig
- type TimePeriod
Constants ¶
View Source
const DateFormat = "1/2/06"
Variables ¶
This section is empty.
Functions ¶
func ParseTimeClock ¶
func ParseTimeClock(cc *CalendarConfig) (tc *timeClock, err error)
Types ¶
type Calendar ¶
type Calendar interface {
RuleAt(t time.Time) (isOn bool, period TimePeriod)
}
func NewCalendar ¶
func NewCalendar(cc *CalendarConfig) (tc Calendar, err error)
type CalendarConfig ¶
type CalendarConfig struct { Location string SchoolDayHours TimeOfDayPeriodConfig VacationHours TimeOfDayPeriodConfig Holidays []DateRangeConfig }
type DB ¶
type DB interface { Open() (err error) Add(d Device) (err error) AddAll(devices []Device) (err error) Remove(ip DeviceIP) (err error) Find(ip DeviceIP) (device Device, found bool, err error) All() (devices []Device, err error) SetActiveUntil(ip DeviceIP, activeUntil time.Time) (err error) // Modify the active time by the delta, taking into account the baseTime. // Typically the baseTIme is "now". // activeTime := max(max(activeTime, baseTime) + delta, baseTime) ModifyActiveUntil(ip DeviceIP, delta time.Duration, baseTime time.Time) (err error) Close() (err error) }
type DatePeriod ¶
type DatePeriod TimePeriod
func ParseDateRange ¶
func ParseDateRange(dr DateRangeConfig, location *time.Location) (dp DatePeriod, err error)
func (DatePeriod) Equal ¶
func (tp DatePeriod) Equal(o DatePeriod) bool
func (DatePeriod) String ¶
func (d DatePeriod) String() string
type DateRangeConfig ¶
type DeviceIP ¶
func GetBlockList ¶
func ParseDeviceIP ¶
func (DeviceIP) MarshalText ¶
func (*DeviceIP) UnmarshalText ¶
type TimeOfDayPeriod ¶
type TimeOfDayPeriod TimePeriod
func ParseTimeOfDayPeriod ¶
func ParseTimeOfDayPeriod(todc TimeOfDayPeriodConfig) (tp TimeOfDayPeriod, err error)
func (TimeOfDayPeriod) Equal ¶
func (tp TimeOfDayPeriod) Equal(o TimeOfDayPeriod) bool
func (TimeOfDayPeriod) String ¶
func (d TimeOfDayPeriod) String() string
type TimeOfDayPeriodConfig ¶
type TimePeriod ¶
func (TimePeriod) Equal ¶
func (tp TimePeriod) Equal(o TimePeriod) bool
Click to show internal directories.
Click to hide internal directories.