Documentation
¶
Index ¶
- type Booking
- type BookingRepository
- type Campsite
- type CampsiteRepository
- type ErrBookingAlreadyCancelled
- type ErrBookingDatesNotAvailable
- type ErrBookingNotFound
- 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 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 }
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 CampsiteRepository ¶
type ErrBookingAlreadyCancelled ¶
type ErrBookingAlreadyCancelled struct {
BookingID string
}
func (ErrBookingAlreadyCancelled) Error ¶
func (e ErrBookingAlreadyCancelled) 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 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 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.