Documentation ¶
Index ¶
- type EventOrderCreated
- type EventStatusUpdated
- type Order
- type Repository
- func (repo *Repository) CreateOrder(ctx context.Context, restaurant *restaurant.Restaurant, ...) (event *EventOrderCreated, err error)
- func (repo *Repository) LoadAggregate(id string) (aggregate events.AggregateDB, err error)
- func (repo *Repository) SaveEvents(aggregateID string, aggregateEvents []events.Event, originalVersion int) (err error)
- func (repo *Repository) UpdateStatus(ctx context.Context, id string, status *orders_pb.OrderStatus) (event *EventStatusUpdated, err error)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventOrderCreated ¶
type EventOrderCreated struct { ID string Restaurant *restaurant.Restaurant Items []*restaurant.MenuItem Status string }
func EventOrderCreatedFromData ¶
func EventOrderCreatedFromData(data bson.M) *EventOrderCreated
func EventOrderCreatedFromProto ¶
func EventOrderCreatedFromProto(cmd *orders_pb.OrderCreated) *EventOrderCreated
func (*EventOrderCreated) AggregateID ¶
func (e *EventOrderCreated) AggregateID() string
func (*EventOrderCreated) Data ¶
func (e *EventOrderCreated) Data() bson.M
func (*EventOrderCreated) EventCategory ¶
func (e *EventOrderCreated) EventCategory() string
func (*EventOrderCreated) EventType ¶
func (e *EventOrderCreated) EventType() string
func (*EventOrderCreated) ToProto ¶
func (e *EventOrderCreated) ToProto() proto.Message
type EventStatusUpdated ¶
func EventStatusUpdatedFromData ¶
func EventStatusUpdatedFromData(data bson.M) *EventStatusUpdated
func EventStatusUpdatedFromProto ¶
func EventStatusUpdatedFromProto(cmd *orders_pb.StatusUpdated) *EventStatusUpdated
func (*EventStatusUpdated) AggregateID ¶
func (e *EventStatusUpdated) AggregateID() string
func (*EventStatusUpdated) Data ¶
func (e *EventStatusUpdated) Data() bson.M
func (*EventStatusUpdated) EventCategory ¶
func (e *EventStatusUpdated) EventCategory() string
func (*EventStatusUpdated) EventType ¶
func (e *EventStatusUpdated) EventType() string
func (*EventStatusUpdated) ToProto ¶
func (e *EventStatusUpdated) ToProto() proto.Message
type Order ¶
type Order struct { ID string `bson:"_id"` Status string `bson:"status"` Restaurant *restaurant.Restaurant `bson:"restaurant"` Items []*restaurant.MenuItem `bson:"items"` }
func NewFromEvents ¶
func (*Order) ApplyEvent ¶
type Repository ¶
type Repository struct { *repository.Base // contains filtered or unexported fields }
func NewRepository ¶
func (*Repository) CreateOrder ¶
func (repo *Repository) CreateOrder(ctx context.Context, restaurant *restaurant.Restaurant, items []*restaurant.MenuItem) (event *EventOrderCreated, err error)
func (*Repository) LoadAggregate ¶
func (repo *Repository) LoadAggregate(id string) (aggregate events.AggregateDB, err error)
func (*Repository) SaveEvents ¶
func (*Repository) UpdateStatus ¶
func (repo *Repository) UpdateStatus(ctx context.Context, id string, status *orders_pb.OrderStatus) (event *EventStatusUpdated, err error)
type Service ¶
type Service struct { orders_pb.UnimplementedOrdersServiceServer // contains filtered or unexported fields }
func NewService ¶
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, cmd *orders_pb.CmdCreateOrder) (event *orders_pb.OrderCreated, err error)
func (*Service) UpdateStatus ¶
func (s *Service) UpdateStatus(ctx context.Context, cmd *orders_pb.CmdUpdateStatus) (res *orders_pb.StatusUpdated, err error)
Click to show internal directories.
Click to hide internal directories.