schema

package
v0.0.0-...-ffaedda Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type EventType `json:"type"`
}

type EventType

type EventType string
const (
	NewOrder          EventType = `new_order`
	CancelOrder       EventType = `cancale_order`
	CompleteOrder     EventType = `complete_order`
	PaymentsConfirmed EventType = `payments_confirmed`
	PaymentsFailed    EventType = `paymants_failed`
	StockConfirmed    EventType = `stock_confirmed`
	StockFailed       EventType = `stock_failed`
)

func GetEventType

func GetEventType(data map[string]any) EventType

type OrderEvent

type OrderEvent struct {
	Event
	OrderID    uuid.UUID       `json:"order_id"`
	CustomerID uuid.UUID       `json:"customer_id"`
	Price      decimal.Decimal `json:"price"`
	PaymentID  uuid.UUID       `json:"payment_id,omitempty"`
	Items      string          `json:"items"`
}

func ToOrderEvent

func ToOrderEvent(values map[string]any) (OrderEvent, error)

func ToRolbackEvent

func ToRolbackEvent(values map[string]any) (OrderEvent, error)

func (OrderEvent) Map

func (e OrderEvent) Map() map[string]string

func (*OrderEvent) SetType

func (e *OrderEvent) SetType(kind EventType)

type PaymentsEvent

type PaymentsEvent struct {
	Event
	OrderID    uuid.UUID `json:"order_id"`
	PaymentsID uuid.UUID `json:"payments_id"`
}

func ToPaymentsEvent

func ToPaymentsEvent(values map[string]any) (PaymentsEvent, error)

func (PaymentsEvent) Map

func (e PaymentsEvent) Map() map[string]string

func (*PaymentsEvent) SetType

func (e *PaymentsEvent) SetType(kind EventType)

type RollbackEvent

type RollbackEvent struct {
	Event
	OrderID uuid.UUID
}

func (RollbackEvent) Map

func (e RollbackEvent) Map() map[string]string

type StockEvent

type StockEvent struct {
	Event
	OrderID uuid.UUID `json:"order_id"`
}

func ToStockEvent

func ToStockEvent(values map[string]any) (StockEvent, error)

func (StockEvent) Map

func (e StockEvent) Map() map[string]string

func (*StockEvent) SetType

func (e *StockEvent) SetType(kind EventType)

Jump to

Keyboard shortcuts

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