Documentation ¶
Index ¶
- type AlreadyBookedError
- type Booking
- type ID
- type Service
- func (svc Service) Book(ctx context.Context, user string, d string, slot Slot) (Booking, error)
- func (svc Service) Bookings(ctx context.Context, date time.Time) ([]Booking, error)
- func (svc Service) CancelBooking(ctx context.Context, id ID, user string) error
- func (svc Service) UserBookings(ctx context.Context, user string) ([]Booking, error)
- type Slot
- type Store
- type UnbookableDeskError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlreadyBookedError ¶
func (AlreadyBookedError) Error ¶
func (err AlreadyBookedError) Error() string
func (AlreadyBookedError) Unwrap ¶
func (err AlreadyBookedError) Unwrap() error
type Service ¶
type Service struct {
Store Store
}
func (Service) Book ¶
Book attempts to create a booking for a user at a for a given time slot. It checks for any issues with the desk's status and for any booking conflicts before creating the booking entry in the store.
func (Service) CancelBooking ¶
type Store ¶
type Store interface { GetDeskBookings(context.Context, string) ([]Booking, error) AddBooking(context.Context, Booking) error GetAllBookingsForDate(context.Context, time.Time) ([]Booking, error) GetFutureBookingsForUser(context.Context, string) ([]Booking, error) DeleteBooking(context.Context, ID) error }
type UnbookableDeskError ¶
func (UnbookableDeskError) Error ¶
func (err UnbookableDeskError) Error() string
Click to show internal directories.
Click to hide internal directories.