Documentation ¶
Index ¶
- type EventStockDecreased
- type EventStockIncreased
- type Repository
- func (repo *Repository) DecreaseStock(ctx context.Context, itemID string, n int32) (event *EventStockDecreased, err error)
- func (repo *Repository) IncreaseStock(ctx context.Context, itemID string, n int32) (event *EventStockIncreased, 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)
- type Service
- type Stock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventStockDecreased ¶
type EventStockDecreased struct { ItemID string `bson:"item_id,omitempty" json:"item_id,omitempty"` N int32 `bson:"n,omitempty" json:"n,omitempty"` }
func EventStockDecreasedFromData ¶
func EventStockDecreasedFromData(data bson.M) *EventStockDecreased
func EventStockDecreasedFromProto ¶
func EventStockDecreasedFromProto(cmd *stock_pb.StockDecreased) *EventStockDecreased
func (*EventStockDecreased) AggregateID ¶
func (e *EventStockDecreased) AggregateID() string
func (*EventStockDecreased) Data ¶
func (e *EventStockDecreased) Data() bson.M
func (*EventStockDecreased) EventCategory ¶
func (e *EventStockDecreased) EventCategory() string
func (*EventStockDecreased) EventType ¶
func (e *EventStockDecreased) EventType() string
func (*EventStockDecreased) ToProto ¶
func (e *EventStockDecreased) ToProto() proto.Message
type EventStockIncreased ¶
type EventStockIncreased struct { ItemID string `bson:"item_id,omitempty" json:"item_id,omitempty"` N int32 `bson:"n,omitempty" json:"n,omitempty"` }
func EventStockIncreasedFromData ¶
func EventStockIncreasedFromData(data bson.M) *EventStockIncreased
func EventStockIncreasedFromProto ¶
func EventStockIncreasedFromProto(cmd *stock_pb.StockIncreased) *EventStockIncreased
func (*EventStockIncreased) AggregateID ¶
func (e *EventStockIncreased) AggregateID() string
func (*EventStockIncreased) Data ¶
func (e *EventStockIncreased) Data() bson.M
func (*EventStockIncreased) EventCategory ¶
func (e *EventStockIncreased) EventCategory() string
func (*EventStockIncreased) EventType ¶
func (e *EventStockIncreased) EventType() string
func (*EventStockIncreased) ToProto ¶
func (e *EventStockIncreased) ToProto() proto.Message
type Repository ¶
type Repository struct { *repository.Base // contains filtered or unexported fields }
func NewRepository ¶
func (*Repository) DecreaseStock ¶
func (repo *Repository) DecreaseStock(ctx context.Context, itemID string, n int32) (event *EventStockDecreased, err error)
func (*Repository) IncreaseStock ¶
func (repo *Repository) IncreaseStock(ctx context.Context, itemID string, n int32) (event *EventStockIncreased, err error)
func (*Repository) LoadAggregate ¶
func (repo *Repository) LoadAggregate(id string) (aggregate events.AggregateDB, err error)
func (*Repository) SaveEvents ¶
type Service ¶
type Service struct { stock_pb.UnimplementedStockServiceServer // contains filtered or unexported fields }
func NewService ¶
func (*Service) DecreaseStock ¶
func (s *Service) DecreaseStock(ctx context.Context, cmd *stock_pb.CmdDecreaseStock) (res *stock_pb.StockDecreased, err error)
func (*Service) IncreaseStock ¶
func (s *Service) IncreaseStock(ctx context.Context, cmd *stock_pb.CmdIncreaseStock) (res *stock_pb.StockIncreased, err error)
Click to show internal directories.
Click to hide internal directories.