order

package
v0.0.0-...-4518f94 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderAggregateType eventstore.AggregateType = "order"
)
View Source
const (
	OrderUpsertV1 = "V1_ORDER_UPSERT"
)

Variables

This section is empty.

Functions

func GetOrderObjectID

func GetOrderObjectID(aggregateID string, tenant string) string

func NewOrderUpsertEvent

func NewOrderUpsertEvent(aggregate eventstore.Aggregate, sourceFields commonmodel.Source, externalSystem commonmodel.ExternalSystem, organizationId string, createdAt time.Time, updatedAt time.Time, confirmedAt, paidAt, fulfilledAt, canceledAt *time.Time) (eventstore.Event, error)

Types

type Order

type Order struct {
	ID             string             `json:"id"`
	Tenant         string             `json:"tenant"`
	OrganizationId string             `json:"organizationId"`
	CreatedAt      time.Time          `json:"createdAt"`
	UpdatedAt      time.Time          `json:"updatedAt"`
	SourceFields   commonmodel.Source `json:"source"`

	ConfirmedAt time.Time `json:"confirmedAt"`
	PaidAt      time.Time `json:"paidAt"`
	FulfilledAt time.Time `json:"fulfilledAt"`
	CanceledAt  time.Time `json:"canceledAt"`
}

type OrderAggregate

type OrderAggregate struct {
	*aggregate.CommonTenantIdAggregate
	Order *Order
}

func LoadOrderAggregate

func LoadOrderAggregate(ctx context.Context, eventStore eventstore.AggregateStore, tenant, objectID string, options eventstore.LoadAggregateOptions) (*OrderAggregate, error)

func NewOrderAggregateWithTenantAndID

func NewOrderAggregateWithTenantAndID(tenant, id string) *OrderAggregate

func (*OrderAggregate) HandleRequest

func (a *OrderAggregate) HandleRequest(ctx context.Context, request any, params ...map[string]any) (any, error)

func (*OrderAggregate) UpsertOrderRequest

func (a *OrderAggregate) UpsertOrderRequest(ctx context.Context, request *orderpb.UpsertOrderGrpcRequest) error

func (*OrderAggregate) When

func (a *OrderAggregate) When(evt eventstore.Event) error

type OrderRequestHandler

type OrderRequestHandler interface {
	HandleWithRetry(ctx context.Context, tenant, objectId string, aggregateRequired bool, request any, params ...map[string]any) (any, error)
}

type OrderUpsertEvent

type OrderUpsertEvent struct {
	Tenant         string `json:"tenant" validate:"required"`
	OrganizationId string `json:"organizationId" validate:"required"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`

	ExternalSystem commonmodel.ExternalSystem `json:"externalSystem,omitempty"`
	SourceFields   commonmodel.Source         `json:"sourceFields"`

	ConfirmedAt *time.Time `json:"confirmedAt"`
	PaidAt      *time.Time `json:"paidAt"`
	FulfilledAt *time.Time `json:"fulfilledAt"`
	CanceledAt  *time.Time `json:"canceledAt"`
}

Jump to

Keyboard shortcuts

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