domain

package
v0.0.0-...-cb92905 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotPaid      = errors.New("order has not paid yet")
	ErrInvalidValue = errors.New("invalid value")
)

Functions

This section is empty.

Types

type CancelledEvent

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

type CreatedEvent

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

type CustomerID

type CustomerID string

func NewCustomerID

func NewCustomerID() CustomerID

func (CustomerID) String

func (id CustomerID) String() string

type Order

type Order struct {
	aggregate.Root
	// contains filtered or unexported fields
}

func NewOrder

func NewOrder(id OrderID, customerID CustomerID,
	productID ProductID, now aggregate.Now,
	status OrderStatus, version aggregate.Version) (*Order, error)

func (*Order) Cancel

func (o *Order) Cancel()

func (*Order) CustomerID

func (o *Order) CustomerID() string

func (*Order) ID

func (o *Order) ID() string

func (*Order) Pay

func (o *Order) Pay()

func (*Order) ProductID

func (o *Order) ProductID() string

func (*Order) Ship

func (o *Order) Ship() error

func (*Order) Status

func (o *Order) Status() OrderStatus

func (*Order) Version

func (o *Order) Version() string

type OrderID

type OrderID string

type OrderStatus

type OrderStatus int
const (
	Unknown OrderStatus = iota
	Submitted
	Shipped
	Canceled
)

type PaidEvent

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

type ProductID

type ProductID string

func NewProductID

func NewProductID() ProductID

func (ProductID) String

func (id ProductID) String() string

Jump to

Keyboard shortcuts

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