Documentation ¶
Index ¶
- func IsAvailable(availability Availability) bool
- func IsErrHourNotAvailable(err error) bool
- func IsErrNoTrainingScheduled(err error) bool
- func IsErrNotFullHour(err error) bool
- func IsErrPastHour(err error) bool
- func IsErrTrainingScheduled(err error) bool
- func IsNotAvailable(availability Availability) bool
- func IsTrainingScheduled(availability Availability) bool
- func NewErrHourNotAvailable() error
- func NewErrNoTrainingScheduled() error
- func NewErrNotFullHour() error
- func NewErrPastHour() error
- func NewErrTrainingScheduled() error
- type Availability
- type Factory
- func (f Factory) Config() FactoryConfig
- func (f Factory) IsZero() bool
- func (f Factory) NewAvailableHour(hour time.Time) (*Hour, error)
- func (f Factory) NewNotAvailableHour(hour time.Time) (*Hour, error)
- func (f Factory) UnmarshalHourFromDatabase(hour time.Time, availability Availability) (*Hour, error)
- type FactoryConfig
- type Hour
- func (h Hour) Availability() Availability
- func (h *Hour) CancelTraining() error
- func (h Hour) HasTrainingScheduled() bool
- func (h Hour) IsAvailable() bool
- func (h *Hour) MakeAvailable() error
- func (h *Hour) MakeNotAvailable() error
- func (h *Hour) ScheduleTraining() error
- func (h *Hour) Time() time.Time
- type Repository
- type TooDistantDateError
- type TooEarlyHourError
- type TooLateHourError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAvailable ¶
func IsAvailable(availability Availability) bool
func IsErrHourNotAvailable ¶
func IsErrNotFullHour ¶
func IsErrPastHour ¶
func IsErrTrainingScheduled ¶
func IsNotAvailable ¶
func IsNotAvailable(availability Availability) bool
func IsTrainingScheduled ¶
func IsTrainingScheduled(availability Availability) bool
func NewErrHourNotAvailable ¶
func NewErrHourNotAvailable() error
func NewErrNoTrainingScheduled ¶
func NewErrNoTrainingScheduled() error
func NewErrNotFullHour ¶
func NewErrNotFullHour() error
func NewErrPastHour ¶
func NewErrPastHour() error
func NewErrTrainingScheduled ¶
func NewErrTrainingScheduled() error
Types ¶
type Availability ¶
type Availability struct {
// contains filtered or unexported fields
}
Availability is enum.
Using struct instead of `type Availability string` for enums allows us to ensure, that we have full control of what values are possible. With `type Availability string` you are able to create `Availability("i_can_put_anything_here")`
func Available ¶
func Available() Availability
func NewAvailabilityFromString ¶
func NewAvailabilityFromString(availabilityStr string) (Availability, error)
func NotAvailable ¶
func NotAvailable() Availability
func TrainingScheduled ¶
func TrainingScheduled() Availability
func (Availability) IsZero ¶
func (h Availability) IsZero() bool
func (Availability) String ¶
func (h Availability) String() string
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func MustNewFactory ¶
func MustNewFactory(fc FactoryConfig) Factory
func NewFactory ¶
func NewFactory(fc FactoryConfig) (Factory, error)
func (Factory) Config ¶
func (f Factory) Config() FactoryConfig
func (Factory) NewNotAvailableHour ¶
func (Factory) UnmarshalHourFromDatabase ¶
func (f Factory) UnmarshalHourFromDatabase(hour time.Time, availability Availability) (*Hour, error)
UnmarshalHourFromDatabase unmarshals Hour from the database.
It should be used only for unmarshalling from the database! You can't use UnmarshalHourFromDatabase as constructor - It may put domain into the invalid state!
type FactoryConfig ¶
func (FactoryConfig) Validate ¶
func (f FactoryConfig) Validate() error
type Hour ¶
type Hour struct {
// contains filtered or unexported fields
}
func (Hour) Availability ¶
func (h Hour) Availability() Availability
func (*Hour) CancelTraining ¶
func (Hour) HasTrainingScheduled ¶
func (Hour) IsAvailable ¶
func (*Hour) MakeAvailable ¶
func (*Hour) MakeNotAvailable ¶
func (*Hour) ScheduleTraining ¶
type Repository ¶
type TooDistantDateError ¶
func (TooDistantDateError) Error ¶
func (e TooDistantDateError) Error() string
type TooEarlyHourError ¶
func (TooEarlyHourError) Error ¶
func (e TooEarlyHourError) Error() string
type TooLateHourError ¶
func (TooLateHourError) Error ¶
func (e TooLateHourError) Error() string
Click to show internal directories.
Click to hide internal directories.