Documentation ¶
Index ¶
- type Booking
- type BookingRepository
- type BookingValidator
- type Campsite
- type CampsiteRepository
- type ErrBookingAlreadyCancelled
- type ErrBookingConcurrentUpdate
- type ErrBookingDatesNotAvailable
- type ErrBookingNotFound
- type ErrBookingValidation
- type MockBookingRepository
- func (_m *MockBookingRepository) Find(ctx context.Context, bookingID string) (*Booking, error)
- func (_m *MockBookingRepository) FindForDateRange(ctx context.Context, campsiteID string, startDate time.Time, endDate time.Time) ([]*Booking, error)
- func (_m *MockBookingRepository) Insert(ctx context.Context, booking *Booking) error
- func (_m *MockBookingRepository) Update(ctx context.Context, booking *Booking) error
- type MockBookingValidator
- type MockCampsiteRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Booking ¶
type Booking struct { // Persistence ID ID int64 // Business ID BookingID string CampsiteID string Email string FullName string StartDate time.Time EndDate time.Time Active bool Version int64 }
func (*Booking) BookingDates ¶
type BookingRepository ¶
type BookingRepository interface { Find(ctx context.Context, bookingID string) (*Booking, error) FindForDateRange( ctx context.Context, campsiteID string, startDate time.Time, endDate time.Time, ) ([]*Booking, error) Insert(ctx context.Context, booking *Booking) error Update(ctx context.Context, booking *Booking) error }
type BookingValidator ¶
type Campsite ¶
type CampsiteRepository ¶
type ErrBookingAlreadyCancelled ¶
type ErrBookingAlreadyCancelled struct {
BookingID string
}
func (ErrBookingAlreadyCancelled) Error ¶
func (e ErrBookingAlreadyCancelled) Error() string
type ErrBookingConcurrentUpdate ¶ added in v1.2.0
type ErrBookingConcurrentUpdate struct{}
func (ErrBookingConcurrentUpdate) Error ¶ added in v1.2.0
func (e ErrBookingConcurrentUpdate) Error() string
type ErrBookingDatesNotAvailable ¶
func (ErrBookingDatesNotAvailable) Error ¶
func (e ErrBookingDatesNotAvailable) Error() string
type ErrBookingNotFound ¶
type ErrBookingNotFound struct {
BookingID string
}
func (ErrBookingNotFound) Error ¶
func (e ErrBookingNotFound) Error() string
type ErrBookingValidation ¶
type ErrBookingValidation struct {
MultiErr *multierror.Error
}
func (*ErrBookingValidation) Append ¶
func (e *ErrBookingValidation) Append(err error)
Append TODO: fix mix of value and pointer receiver
func (ErrBookingValidation) Error ¶
func (e ErrBookingValidation) Error() string
type MockBookingRepository ¶
MockBookingRepository is an autogenerated mock type for the BookingRepository type
func NewMockBookingRepository ¶
func NewMockBookingRepository(t interface { mock.TestingT Cleanup(func()) }) *MockBookingRepository
NewMockBookingRepository creates a new instance of MockBookingRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockBookingRepository) Find ¶
Find provides a mock function with given fields: ctx, bookingID
func (*MockBookingRepository) FindForDateRange ¶
func (_m *MockBookingRepository) FindForDateRange(ctx context.Context, campsiteID string, startDate time.Time, endDate time.Time) ([]*Booking, error)
FindForDateRange provides a mock function with given fields: ctx, campsiteID, startDate, endDate
type MockBookingValidator ¶
MockBookingValidator is an autogenerated mock type for the BookingValidator type
func NewMockBookingValidator ¶
func NewMockBookingValidator(t interface { mock.TestingT Cleanup(func()) }) *MockBookingValidator
NewMockBookingValidator creates a new instance of MockBookingValidator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockBookingValidator) Validate ¶
func (_m *MockBookingValidator) Validate(b *Booking) error
Validate provides a mock function with given fields: b
type MockCampsiteRepository ¶
MockCampsiteRepository is an autogenerated mock type for the CampsiteRepository type
func NewMockCampsiteRepository ¶
func NewMockCampsiteRepository(t interface { mock.TestingT Cleanup(func()) }) *MockCampsiteRepository
NewMockCampsiteRepository creates a new instance of MockCampsiteRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.