Documentation ¶
Overview ¶
package resource holds non-overlapping bookings with arbitrary durations
Index ¶
- type Booking
- type Diary
- func (d *Diary) ClearBefore(t time.Time)
- func (d *Diary) Delete(delete string) error
- func (d *Diary) GetBookings() ([]Booking, error)
- func (d *Diary) GetCount() int
- func (d *Diary) IsAvailable() (bool, string)
- func (d *Diary) Request(when interval.Interval, name string) error
- func (d *Diary) SetAvailable(reason string)
- func (d *Diary) SetUnavailable(reason string)
- func (d *Diary) ValidateBooking(b Booking) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Booking ¶
Booking represents a booking. This is not used internally, it's just for returning booking info from GetBookings() and validating bookings with ValidateBooking()
type Diary ¶
type Diary struct { *sync.RWMutex `json:"-"` Name string // unique, persistant name // contains filtered or unexported fields }
Diary represents the bookings of a resources
func (*Diary) ClearBefore ¶
ClearBefore removes all old bookings
func (*Diary) GetBookings ¶
GetBookings returns all bookings
func (*Diary) IsAvailable ¶
func (*Diary) SetAvailable ¶
func (*Diary) SetUnavailable ¶
func (*Diary) ValidateBooking ¶
ValidateBooking checks if a given booking matches an existing booking Returns false if the resource is not available so that it can be used as a check on whether to supply connection info to user (don't if resource if not available)
Click to show internal directories.
Click to hide internal directories.