domain

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

func (b *Booking) BookingDates() []time.Time

func (*Booking) String

func (b *Booking) String() string

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 BookingValidator interface {
	Validate(b *Booking) error
}

type Campsite

type Campsite struct {
	// Persistence ID
	ID int64
	// Business ID
	CampsiteID    string
	CampsiteCode  string
	Capacity      int32
	DrinkingWater bool
	Restrooms     bool
	PicnicTable   bool
	FirePit       bool
	Active        bool
}

func (*Campsite) String

func (c *Campsite) String() string

type CampsiteRepository

type CampsiteRepository interface {
	FindAll(ctx context.Context) ([]*Campsite, error)
	Insert(ctx context.Context, campsite *Campsite) error
}

type ErrBookingAlreadyCancelled

type ErrBookingAlreadyCancelled struct {
	BookingID string
}

func (ErrBookingAlreadyCancelled) Error

type ErrBookingConcurrentUpdate added in v1.2.0

type ErrBookingConcurrentUpdate struct{}

func (ErrBookingConcurrentUpdate) Error added in v1.2.0

type ErrBookingDatesNotAvailable

type ErrBookingDatesNotAvailable struct {
	StartDate time.Time
	EndDate   time.Time
}

func (ErrBookingDatesNotAvailable) Error

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

type MockBookingRepository struct {
	mock.Mock
}

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

func (_m *MockBookingRepository) Find(ctx context.Context, bookingID string) (*Booking, error)

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

func (*MockBookingRepository) Insert

func (_m *MockBookingRepository) Insert(ctx context.Context, booking *Booking) error

Insert provides a mock function with given fields: ctx, booking

func (*MockBookingRepository) Update

func (_m *MockBookingRepository) Update(ctx context.Context, booking *Booking) error

Update provides a mock function with given fields: ctx, booking

type MockBookingValidator

type MockBookingValidator struct {
	mock.Mock
}

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

type MockCampsiteRepository struct {
	mock.Mock
}

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.

func (*MockCampsiteRepository) FindAll

func (_m *MockCampsiteRepository) FindAll(ctx context.Context) ([]*Campsite, error)

FindAll provides a mock function with given fields: ctx

func (*MockCampsiteRepository) Insert

func (_m *MockCampsiteRepository) Insert(ctx context.Context, campsite *Campsite) error

Insert provides a mock function with given fields: ctx, campsite

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL