Documentation ¶
Index ¶
- Constants
- Variables
- func AssignNew(sid stream.ID, blank *Flight, c Assign) error
- func MutatorController(ctx context.Context, eventBus eventbus.Bus, commandBus commandbus.Bus, ...) (err error)
- func NewAssignCommand(sid stream.ID, c Assign) stream.Command
- func NewStartCheckInCommand(sid stream.ID, c StartCheckIn) stream.Command
- func NewStartRouteCommand(sid stream.ID, c StartRoute) stream.Command
- func NewStopRouteCommand(sid stream.ID, c StopRoute) stream.Command
- func ProjectionController(ctx context.Context, eventBus eventbus.Bus, proj ...Projection) error
- type ActiveFlightsProjection
- func (p *ActiveFlightsProjection) FlightAssignedNew(_ context.Context, sid stream.ID, v stream.Version, e Assigned) error
- func (p *ActiveFlightsProjection) FlightCheckInStarted(_ context.Context, sid stream.ID, v stream.Version, e CheckInStarted) error
- func (p *ActiveFlightsProjection) FlightExists(aircraftID stream.ID) bool
- func (p *ActiveFlightsProjection) FlightID(aircraftID stream.ID) stream.ID
- func (p *ActiveFlightsProjection) FlightRouteStarted(_ context.Context, sid stream.ID, v stream.Version, e RouteStarted) error
- func (p *ActiveFlightsProjection) FlightRouteStopped(_ context.Context, sid stream.ID, v stream.Version, e RouteStopped) error
- type Airport
- type Assign
- type Assigned
- type CheckInStarted
- type Codec
- type Flight
- type FlightsProjection
- func (p *FlightsProjection) Find(sid stream.ID) (Model, error)
- func (p *FlightsProjection) FlightAssignedNew(_ context.Context, sid stream.ID, v stream.Version, e Assigned) error
- func (p *FlightsProjection) FlightCheckInStarted(_ context.Context, sid stream.ID, v stream.Version, e CheckInStarted) error
- func (p *FlightsProjection) FlightRouteStarted(_ context.Context, sid stream.ID, v stream.Version, e RouteStarted) error
- func (p *FlightsProjection) FlightRouteStopped(_ context.Context, sid stream.ID, v stream.Version, e RouteStopped) error
- func (p *FlightsProjection) Flights() map[stream.ID]Model
- type Model
- type Mutator
- type OperationLog
- type Processor
- type Projection
- type RouteStarted
- type RouteStopped
- type StartCheckIn
- type StartRoute
- type State
- type StopRoute
Constants ¶
View Source
const ( AssignNewCommand = stream.CommandType("AssignNew") StartRouteCommand = stream.CommandType("StartRoute") StopRouteCommand = stream.CommandType("StopRoute") StartCheckInCommand = stream.CommandType("StartCheckIn") )
View Source
const ( // Flight context AssignedEvent = stream.EventType("FlightCreated") RouteStartedEvent = stream.EventType("FlightRouteStarted") RouteStoppedEvent = stream.EventType("FlightRouteStopped") CheckInStartedEvent = stream.EventType("FlightCheckInStarted") )
View Source
const Stream = stream.Type("Flight")
Variables ¶
Functions ¶
func MutatorController ¶
func MutatorController( ctx context.Context, eventBus eventbus.Bus, commandBus commandbus.Bus, activeFlightsProjection *ActiveFlightsProjection, ) (err error)
func NewStartCheckInCommand ¶
func NewStartCheckInCommand(sid stream.ID, c StartCheckIn) stream.Command
func NewStartRouteCommand ¶
func NewStartRouteCommand(sid stream.ID, c StartRoute) stream.Command
func ProjectionController ¶
Types ¶
type ActiveFlightsProjection ¶
type ActiveFlightsProjection struct {
// contains filtered or unexported fields
}
func NewActiveFlightsProjection ¶
func NewActiveFlightsProjection() *ActiveFlightsProjection
func (*ActiveFlightsProjection) FlightAssignedNew ¶
func (*ActiveFlightsProjection) FlightCheckInStarted ¶
func (p *ActiveFlightsProjection) FlightCheckInStarted(_ context.Context, sid stream.ID, v stream.Version, e CheckInStarted) error
func (*ActiveFlightsProjection) FlightExists ¶
func (p *ActiveFlightsProjection) FlightExists(aircraftID stream.ID) bool
func (*ActiveFlightsProjection) FlightID ¶
func (p *ActiveFlightsProjection) FlightID(aircraftID stream.ID) stream.ID
func (*ActiveFlightsProjection) FlightRouteStarted ¶
func (p *ActiveFlightsProjection) FlightRouteStarted(_ context.Context, sid stream.ID, v stream.Version, e RouteStarted) error
func (*ActiveFlightsProjection) FlightRouteStopped ¶
func (p *ActiveFlightsProjection) FlightRouteStopped(_ context.Context, sid stream.ID, v stream.Version, e RouteStopped) error
type Assign ¶
type CheckInStarted ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
func (*Codec) Commands ¶
func (c *Codec) Commands() *escodec.DefaultCodec
func (*Codec) Events ¶
func (c *Codec) Events() *escodec.DefaultCodec
func (*Codec) Replies ¶
func (c *Codec) Replies() *escodec.DefaultCodec
type Flight ¶
func (*Flight) StartCheckIn ¶
func (a *Flight) StartCheckIn(c StartCheckIn) error
func (*Flight) StartRoute ¶
func (a *Flight) StartRoute(c StartRoute) error
type FlightsProjection ¶
type FlightsProjection struct {
// contains filtered or unexported fields
}
func NewFlightsProjection ¶
func NewFlightsProjection() *FlightsProjection
func (*FlightsProjection) FlightAssignedNew ¶
func (*FlightsProjection) FlightCheckInStarted ¶
func (p *FlightsProjection) FlightCheckInStarted(_ context.Context, sid stream.ID, v stream.Version, e CheckInStarted) error
func (*FlightsProjection) FlightRouteStarted ¶
func (p *FlightsProjection) FlightRouteStarted(_ context.Context, sid stream.ID, v stream.Version, e RouteStarted) error
func (*FlightsProjection) FlightRouteStopped ¶
func (p *FlightsProjection) FlightRouteStopped(_ context.Context, sid stream.ID, v stream.Version, e RouteStopped) error
type Mutator ¶
type Mutator interface { AssignNew(context.Context, *Flight, Assign) error StartRouteFlight(context.Context, *Flight, StartRoute) error StopRouteFlight(context.Context, *Flight, StopRoute) error StartCheckIn(context.Context, *Flight, StartCheckIn) error }
func NewMutator ¶
func NewMutator( activeFlightProj *ActiveFlightsProjection, ) Mutator
type OperationLog ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor(proj ...Projection) *Processor
type Projection ¶
type Projection interface { FlightAssignedNew(context.Context, stream.ID, stream.Version, Assigned) error FlightRouteStarted(context.Context, stream.ID, stream.Version, RouteStarted) error FlightRouteStopped(context.Context, stream.ID, stream.Version, RouteStopped) error FlightCheckInStarted(context.Context, stream.ID, stream.Version, CheckInStarted) error }
type RouteStarted ¶
type RouteStopped ¶
Click to show internal directories.
Click to hide internal directories.