Documentation ¶
Index ¶
- func PrepareOrderApprovedEvent(order *pb.Order) ([]byte, string, error)
- func PrepareOrderCreatedEvent(order *pb.Order) ([]byte, string, error)
- func PrepareOrderPendingEvent(order *pb.Order) ([]byte, string, error)
- func PrepareOrderRejectedEvent(order *pb.Order) ([]byte, string, error)
- type ConsumerController
- type OrderService
- func (svc OrderService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderRequest) (*pb.PlaceOrderResponse, error)
- func (svc OrderService) ProcessPaymentProcessedEvent(ctx context.Context, req *eventpb.PaymentProcessedEvent) (*emptypb.Empty, error)
- func (svc OrderService) ProcessProductPriceQuoteEvent(ctx context.Context, req *eventpb.ProductPriceQuoteEvent) (*emptypb.Empty, error)
- func (svc OrderService) ProcessShipmentAllocationEvent(ctx context.Context, req *eventpb.ShipmentAllocationEvent) (*emptypb.Empty, error)
- func (svc OrderService) ProcessStockReservationEvent(ctx context.Context, req *eventpb.StockReservationEvent) (*emptypb.Empty, error)
- func (svc OrderService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInfoRequest) (*commonpb.ServiceInfoResponse, error)
- func (svc OrderService) ViewOrder(ctx context.Context, req *pb.ViewOrderRequest) (*pb.ViewOrderResponse, error)
- func (svc OrderService) ViewOrders(ctx context.Context, req *pb.ViewOrdersRequest) (*pb.ViewOrdersResponse, error)
- type ServiceConfig
- type StorageController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsumerController ¶
type ConsumerController interface { messaging.ConsumerController Attach(svc pb.OrderServiceServer) }
Interface for event consumption Flexibility for seperate controllers for different messaging systems (e.g. Kafka, NATS, etc)
type OrderService ¶
type OrderService struct { pb.UnimplementedOrderServiceServer // contains filtered or unexported fields }
Interface for the service
func NewOrderService ¶
func NewOrderService(cfg *ServiceConfig, store StorageController) *OrderService
Create the order service
func (OrderService) PlaceOrder ¶
func (svc OrderService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderRequest) (*pb.PlaceOrderResponse, error)
func (OrderService) ProcessPaymentProcessedEvent ¶
func (svc OrderService) ProcessPaymentProcessedEvent(ctx context.Context, req *eventpb.PaymentProcessedEvent) (*emptypb.Empty, error)
func (OrderService) ProcessProductPriceQuoteEvent ¶
func (svc OrderService) ProcessProductPriceQuoteEvent(ctx context.Context, req *eventpb.ProductPriceQuoteEvent) (*emptypb.Empty, error)
func (OrderService) ProcessShipmentAllocationEvent ¶
func (svc OrderService) ProcessShipmentAllocationEvent(ctx context.Context, req *eventpb.ShipmentAllocationEvent) (*emptypb.Empty, error)
func (OrderService) ProcessStockReservationEvent ¶
func (svc OrderService) ProcessStockReservationEvent(ctx context.Context, req *eventpb.StockReservationEvent) (*emptypb.Empty, error)
func (OrderService) ServiceInfo ¶
func (svc OrderService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInfoRequest) (*commonpb.ServiceInfoResponse, error)
func (OrderService) ViewOrder ¶
func (svc OrderService) ViewOrder(ctx context.Context, req *pb.ViewOrderRequest) (*pb.ViewOrderResponse, error)
func (OrderService) ViewOrders ¶
func (svc OrderService) ViewOrders(ctx context.Context, req *pb.ViewOrdersRequest) (*pb.ViewOrdersResponse, error)
type ServiceConfig ¶
type ServiceConfig struct { config.SharedConfig // Dynamically loaded configuration Postgres config.PostgresConfig Kafka config.KafkaConfig }Shared
Order Service Configuration
func NewServiceConfig ¶
func NewServiceConfig() (*ServiceConfig, error)
load the base service configuration
type StorageController ¶
type StorageController interface { GetOrder(ctx context.Context, orderId string) (*pb.Order, error) GetCustomerOrders(ctx context.Context, customerId string) ([]*pb.Order, error) CreateOrder(ctx context.Context, order *pb.Order) (*pb.Order, error) ApproveOrder(ctx context.Context, orderId string, transactionId string) (*pb.Order, error) ProcessOrder(ctx context.Context, orderId string, itemsPrice float32) (*pb.Order, error) RejectOrder(ctx context.Context, orderId string) (*pb.Order, error) SetOrderShipmentId(ctx context.Context, orderId string, shippingId string) error }
Interface for database methods Flexibility for implementing seperate controllers for different databases (e.g. Postgres, MongoDB, etc)
Click to show internal directories.
Click to hide internal directories.