domain

package
v0.0.0-...-9345043 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateInviteCommand eh.CommandType = "CreateInvite"

	AcceptInviteCommand  eh.CommandType = "AcceptInvite"
	DeclineInviteCommand eh.CommandType = "DeclineInvite"

	ConfirmInviteCommand eh.CommandType = "ConfirmInvite"
	DenyInviteCommand    eh.CommandType = "DenyInvite"
)
View Source
const (
	InviteCreatedEvent eh.EventType = "InviteCreated"

	InviteAcceptedEvent eh.EventType = "InviteAccepted"
	InviteDeclinedEvent eh.EventType = "InviteDeclined"

	InviteConfirmedEvent eh.EventType = "InviteConfirmed"
	InviteDeniedEvent    eh.EventType = "InviteDenied"
)
View Source
const InvitationAggregateType eh.AggregateType = "Invitation"

InvitationAggregateType is the type name of the aggregate.

View Source
const ResponseSagaType eh.SagaType = "ResponseSaga"

ResponseSagaType is the type of the saga.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptInvite

type AcceptInvite struct {
	InvitationID eh.UUID
}

AcceptInvite is a command for accepting invites.

func (AcceptInvite) AggregateID

func (c AcceptInvite) AggregateID() eh.UUID

func (AcceptInvite) AggregateType

func (c AcceptInvite) AggregateType() eh.AggregateType

func (AcceptInvite) CommandType

func (c AcceptInvite) CommandType() eh.CommandType

type ConfirmInvite

type ConfirmInvite struct {
	InvitationID eh.UUID
}

ConfirmInvite is a command for confirming invites.

func (ConfirmInvite) AggregateID

func (c ConfirmInvite) AggregateID() eh.UUID

func (ConfirmInvite) AggregateType

func (c ConfirmInvite) AggregateType() eh.AggregateType

func (ConfirmInvite) CommandType

func (c ConfirmInvite) CommandType() eh.CommandType

type CreateInvite

type CreateInvite struct {
	InvitationID eh.UUID
	Name         string
	Age          int `eh:"optional"`
}

CreateInvite is a command for creating invites.

func (CreateInvite) AggregateID

func (c CreateInvite) AggregateID() eh.UUID

func (CreateInvite) AggregateType

func (c CreateInvite) AggregateType() eh.AggregateType

func (CreateInvite) CommandType

func (c CreateInvite) CommandType() eh.CommandType

type DeclineInvite

type DeclineInvite struct {
	InvitationID eh.UUID
}

DeclineInvite is a command for declining invites.

func (DeclineInvite) AggregateID

func (c DeclineInvite) AggregateID() eh.UUID

func (DeclineInvite) AggregateType

func (c DeclineInvite) AggregateType() eh.AggregateType

func (DeclineInvite) CommandType

func (c DeclineInvite) CommandType() eh.CommandType

type DenyInvite

type DenyInvite struct {
	InvitationID eh.UUID
}

DenyInvite is a command for confirming invites.

func (DenyInvite) AggregateID

func (c DenyInvite) AggregateID() eh.UUID

func (DenyInvite) AggregateType

func (c DenyInvite) AggregateType() eh.AggregateType

func (DenyInvite) CommandType

func (c DenyInvite) CommandType() eh.CommandType

type GuestList

type GuestList struct {
	ID           eh.UUID
	NumGuests    int
	NumAccepted  int
	NumDeclined  int
	NumConfirmed int
	NumDenied    int
}

GuestList is a read model object for the guest list.

type GuestListProjector

type GuestListProjector struct {
	// contains filtered or unexported fields
}

GuestListProjector is a projector that updates the guest list.

func NewGuestListProjector

func NewGuestListProjector(repository eh.ReadRepository, eventID eh.UUID) *GuestListProjector

NewGuestListProjector creates a new GuestListProjector.

func (*GuestListProjector) HandleEvent

func (p *GuestListProjector) HandleEvent(event eh.Event)

HandleEvent implements the HandleEvent method of the EventHandler interface.

func (*GuestListProjector) HandlerType

func (p *GuestListProjector) HandlerType() eh.EventHandlerType

HandlerType implements the HandlerType method of the EventHandler interface.

type Invitation

type Invitation struct {
	ID     eh.UUID
	Name   string
	Age    int
	Status string
}

Invitation is a read model object for an invitation.

type InvitationAggregate

type InvitationAggregate struct {
	// AggregateBase implements most of the eventhorizon.Aggregate interface.
	*eh.AggregateBase
	// contains filtered or unexported fields
}

InvitationAggregate is the root aggregate.

The aggregate root will guard that the invitation can only be accepted OR declined, but not both.

func NewInvitationAggregate

func NewInvitationAggregate(id eh.UUID) *InvitationAggregate

NewInvitationAggregate creates a new InvitationAggregate with an ID.

func (*InvitationAggregate) AggregateType

func (i *InvitationAggregate) AggregateType() eh.AggregateType

AggregateType implements the AggregateType method of the Aggregate interface.

func (*InvitationAggregate) ApplyEvent

func (i *InvitationAggregate) ApplyEvent(event eh.Event)

ApplyEvent implements the ApplyEvent method of the Aggregate interface.

func (*InvitationAggregate) HandleCommand

func (i *InvitationAggregate) HandleCommand(command eh.Command) error

HandleCommand implements the HandleCommand method of the Aggregate interface.

type InvitationProjector

type InvitationProjector struct {
	// contains filtered or unexported fields
}

InvitationProjector is a projector that updates the invitations.

func NewInvitationProjector

func NewInvitationProjector(repository eh.ReadRepository) *InvitationProjector

NewInvitationProjector creates a new InvitationProjector.

func (*InvitationProjector) HandleEvent

func (p *InvitationProjector) HandleEvent(event eh.Event)

HandleEvent implements the HandleEvent method of the EventHandler interface.

func (*InvitationProjector) HandlerType

func (p *InvitationProjector) HandlerType() eh.EventHandlerType

HandlerType implements the HandlerType method of the EventHandler interface.

type InviteAccepted

type InviteAccepted struct {
	InvitationID eh.UUID `bson:"invitation_id"`
}

InviteAccepted is an event for when an invite has been accepted.

func (InviteAccepted) AggregateID

func (c InviteAccepted) AggregateID() eh.UUID

func (InviteAccepted) AggregateType

func (c InviteAccepted) AggregateType() eh.AggregateType

func (InviteAccepted) EventType

func (c InviteAccepted) EventType() eh.EventType

type InviteConfirmed

type InviteConfirmed struct {
	InvitationID eh.UUID `bson:"invitation_id"`
}

InviteConfirmed is an event for when an invite has been confirmed as booked.

func (InviteConfirmed) AggregateID

func (c InviteConfirmed) AggregateID() eh.UUID

func (InviteConfirmed) AggregateType

func (c InviteConfirmed) AggregateType() eh.AggregateType

func (InviteConfirmed) EventType

func (c InviteConfirmed) EventType() eh.EventType

type InviteCreated

type InviteCreated struct {
	InvitationID eh.UUID `bson:"invitation_id"`
	Name         string  `bson:"name"`
	Age          int     `bson:"age"`
}

InviteCreated is an event for when an invite has been created.

func (InviteCreated) AggregateID

func (c InviteCreated) AggregateID() eh.UUID

func (InviteCreated) AggregateType

func (c InviteCreated) AggregateType() eh.AggregateType

func (InviteCreated) EventType

func (c InviteCreated) EventType() eh.EventType

type InviteDeclined

type InviteDeclined struct {
	InvitationID eh.UUID `bson:"invitation_id"`
}

InviteDeclined is an event for when an invite has been declined.

func (InviteDeclined) AggregateID

func (c InviteDeclined) AggregateID() eh.UUID

func (InviteDeclined) AggregateType

func (c InviteDeclined) AggregateType() eh.AggregateType

func (InviteDeclined) EventType

func (c InviteDeclined) EventType() eh.EventType

type InviteDenied

type InviteDenied struct {
	InvitationID eh.UUID `bson:"invitation_id"`
}

InviteDenied is an event for when an invite has been denied to book.

func (InviteDenied) AggregateID

func (c InviteDenied) AggregateID() eh.UUID

func (InviteDenied) AggregateType

func (c InviteDenied) AggregateType() eh.AggregateType

func (InviteDenied) EventType

func (c InviteDenied) EventType() eh.EventType

type Logger

type Logger struct{}

Logger is a simple event handler for logging all events.

func (*Logger) Notify

func (l *Logger) Notify(event eh.Event)

Notify implements the HandleEvent method of the EventHandler interface.

type ResponseSaga

type ResponseSaga struct {
	*eh.SagaBase
	// contains filtered or unexported fields
}

ResponseSaga is a saga that confirmes all accepted invites until a guest limit has been reached.

func NewResponseSaga

func NewResponseSaga(commandBus eh.CommandBus, guestLimit int) *ResponseSaga

NewResponseSaga returns a new ResponseSage with a guest limit.

func (*ResponseSaga) RunSaga

func (s *ResponseSaga) RunSaga(event eh.Event) []eh.Command

RunSaga implements the Run saga method of the Saga interface.

func (*ResponseSaga) SagaType

func (s *ResponseSaga) SagaType() eh.SagaType

SagaType implements the SagaType method of the Saga interface.

Jump to

Keyboard shortcuts

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