Versions in this module Expand all Collapse all v0 v0.4.8 Jan 3, 2026 v0.4.7 Dec 22, 2025 Changes in this version + var ErrCloseBeforeOpen = errors.New("close time must be after open time") + var ErrEndBeforeStart = errors.New("end time must be after start time") + type DayHours struct + CloseTime TimeOfDay + IsClosed bool + OpenTime TimeOfDay + Weekday Weekday + func NewClosedDay(weekday Weekday) *DayHours + func NewDayHours(weekday Weekday, openTime, closeTime TimeOfDay) (*DayHours, error) + func (a *DayHours) Duration() int + func (a *DayHours) IsOpen(t TimeOfDay) bool + func (a *DayHours) SlotCount(slotDurationMinutes int) int + func (a *DayHours) Validate() error + type DaySlots struct + Date time.Time + Slots []*Slot + func NewDaySlots(date time.Time, dayHours *DayHours, slotDurationMinutes int) *DaySlots + func (a *DaySlots) AvailableCount() int + func (a *DaySlots) GetSlot(id string) *Slot + func (a *DaySlots) MarkBooked(slotID string) bool + func (a *DaySlots) MarkHeld(slotID string) bool + type OpeningHours struct + Days map[Weekday]*DayHours + func NewOpeningHours() *OpeningHours + func (a *OpeningHours) GetDayHours(weekday Weekday) *DayHours + func (a *OpeningHours) GetDayHoursForDate(date time.Time) *DayHours + func (a *OpeningHours) IsOpenOn(weekday Weekday) bool + func (a *OpeningHours) SetClosed(weekday Weekday) + func (a *OpeningHours) SetDayHours(hours *DayHours) error + func (a *OpeningHours) SetOpen(weekday Weekday, openTime, closeTime TimeOfDay) error + func (a *OpeningHours) Validate() error + type OrphanGap struct + EndTime TimeOfDay + Reason OrphanGapReason + StartTime TimeOfDay + type OrphanGapDetector struct + func NewOrphanGapDetector(dayHours *DayHours, existingBookings []*TimeRange, slotDuration int) *OrphanGapDetector + func (a *OrphanGapDetector) Detect(selection *TimeRange) []*OrphanGap + func (a *OrphanGapDetector) GetFirstOrphanGap(selection *TimeRange) *OrphanGap + func (a *OrphanGapDetector) HasOrphanGaps(selection *TimeRange) bool + type OrphanGapReason string + const OrphanGapReasonBetweenBookings + const OrphanGapReasonEndOfWindow + const OrphanGapReasonStartOfWindow + type Slot struct + Date time.Time + EndTime TimeOfDay + ID string + StartTime TimeOfDay + State SlotState + func NewSlot(date time.Time, startTime, endTime TimeOfDay, state SlotState) *Slot + func (a *Slot) Duration() int + func (a *Slot) IsAvailable() bool + type SlotState string + const SlotStateAvailable + const SlotStateBooked + const SlotStateHeld + const SlotStateMaintenance + type TimeOfDay int + func MustTimeOfDay(hours, minutes int) TimeOfDay + func NewTimeOfDay(hours, minutes int) (TimeOfDay, error) + func ParseTimeOfDay(value string) (TimeOfDay, error) + func (a TimeOfDay) Add(minutes int) TimeOfDay + func (a TimeOfDay) After(other TimeOfDay) bool + func (a TimeOfDay) Before(other TimeOfDay) bool + func (a TimeOfDay) Equal(other TimeOfDay) bool + func (a TimeOfDay) Hours() int + func (a TimeOfDay) Minutes() int + func (a TimeOfDay) String() string + func (a TimeOfDay) TotalMinutes() int + type TimeRange struct + func NewTimeRange(date time.Time, startTime, endTime TimeOfDay) (*TimeRange, error) + func (a *TimeRange) Contains(t TimeOfDay) bool + func (a *TimeRange) Date() time.Time + func (a *TimeRange) Duration() int + func (a *TimeRange) EndTime() TimeOfDay + func (a *TimeRange) Overlaps(other *TimeRange) bool + func (a *TimeRange) SlotCount(slotDurationMinutes int) int + func (a *TimeRange) StartTime() TimeOfDay + func (a *TimeRange) String() string + type Weekday int + const Friday + const Monday + const Saturday + const Sunday + const Thursday + const Tuesday + const Wednesday + func WeekdayFromGoWeekday(w time.Weekday) Weekday + func (a Weekday) GoWeekday() time.Weekday + func (a Weekday) String() string