Documentation ¶
Index ¶
- Constants
- Variables
- func GetOrderAggregateID(eventAggregateID string) string
- func GetShopItemsTotalPrice(shopItems []*models.ShopItem) float64
- func IsAggregateNotFound(aggregate es.Aggregate) bool
- type OrderAggregate
- func (a *OrderAggregate) CancelOrder(ctx context.Context, cancelReason string) error
- func (a *OrderAggregate) ChangeDeliveryAddress(ctx context.Context, deliveryAddress string) error
- func (a *OrderAggregate) CompleteOrder(ctx context.Context, deliveryTimestamp time.Time) error
- func (a *OrderAggregate) CreateOrder(ctx context.Context, shopItems []*models.ShopItem, ...) error
- func (a *OrderAggregate) PayOrder(ctx context.Context, payment models.Payment) error
- func (a *OrderAggregate) SubmitOrder(ctx context.Context) error
- func (a *OrderAggregate) UpdateShoppingCart(ctx context.Context, shopItems []*models.ShopItem) error
- func (a *OrderAggregate) When(evt es.Event) error
Constants ¶
View Source
const (
OrderAggregateType es.AggregateType = "order"
)
Variables ¶
View Source
var ( ErrOrderAlreadyCompleted = errors.New("Order already completed") ErrOrderAlreadyCanceled = errors.New("Order is already canceled") ErrOrderMustBePaidBeforeDelivered = errors.New("Order must be paid before been delivered") ErrCancelReasonRequired = errors.New("Cancel reason must be provided") ErrOrderAlreadyCancelled = errors.New("order already cancelled") ErrAlreadyPaid = errors.New("already paid") ErrAlreadySubmitted = errors.New("already submitted") ErrOrderNotPaid = errors.New("order not paid") ErrOrderNotFound = errors.New("order not found") ErrAlreadyCreated = errors.New("order with given id already created") ErrOrderShopItemsIsRequired = errors.New("order shop items is required") ErrInvalidDeliveryAddress = errors.New("Invalid delivery address") )
Functions ¶
func GetOrderAggregateID ¶
GetOrderAggregateID get order aggregate id for eventstoredb
func GetShopItemsTotalPrice ¶
func IsAggregateNotFound ¶
Types ¶
type OrderAggregate ¶
type OrderAggregate struct { *es.AggregateBase Order *models.Order }
func LoadOrderAggregate ¶
func LoadOrderAggregate(ctx context.Context, eventStore es.AggregateStore, aggregateID string) (*OrderAggregate, error)
func NewOrderAggregate ¶
func NewOrderAggregate() *OrderAggregate
func NewOrderAggregateWithID ¶
func NewOrderAggregateWithID(id string) *OrderAggregate
func (*OrderAggregate) CancelOrder ¶
func (a *OrderAggregate) CancelOrder(ctx context.Context, cancelReason string) error
func (*OrderAggregate) ChangeDeliveryAddress ¶
func (a *OrderAggregate) ChangeDeliveryAddress(ctx context.Context, deliveryAddress string) error
func (*OrderAggregate) CompleteOrder ¶
func (*OrderAggregate) CreateOrder ¶
func (*OrderAggregate) SubmitOrder ¶
func (a *OrderAggregate) SubmitOrder(ctx context.Context) error
func (*OrderAggregate) UpdateShoppingCart ¶
Click to show internal directories.
Click to hide internal directories.