Documentation ¶
Index ¶
- func PrepareProductCreatedEvent(product *pb.Product) ([]byte, string, error)
- func PrepareProductDeletedEvent(product *pb.Product) ([]byte, string, error)
- func PrepareProductPriceQuoteEvent_Avaliable(orderId string, productQuantities map[string]int32, ...) ([]byte, string, error)
- func PrepareProductPriceQuoteEvent_Unavaliable(orderId string) ([]byte, string, error)
- func PrepareProductPriceUpdatedEvent(product *pb.Product) ([]byte, string, error)
- type ConsumerController
- type ProductService
- func (svc ProductService) ProcessOrderCreatedEvent(ctx context.Context, req *eventpb.OrderCreatedEvent) (*emptypb.Empty, error)
- func (svc ProductService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInfoRequest) (*commonpb.ServiceInfoResponse, error)
- func (svc ProductService) ViewProduct(ctx context.Context, req *pb.ViewProductRequest) (*pb.ViewProductResponse, error)
- func (svc ProductService) ViewProducts(ctx context.Context, req *pb.ViewProductsRequest) (*pb.ViewProductsResponse, 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.ProductServiceServer) }
Interface for event consumption Flexibility for seperate controllers for different messaging systems (e.g. Kafka, NATS, etc)
type ProductService ¶
type ProductService struct { pb.UnimplementedProductServiceServer // contains filtered or unexported fields }
Interface for the service
func NewProductService ¶
func NewProductService(cfg *ServiceConfig, store StorageController) *ProductService
Create the product service
func (ProductService) ProcessOrderCreatedEvent ¶
func (svc ProductService) ProcessOrderCreatedEvent(ctx context.Context, req *eventpb.OrderCreatedEvent) (*emptypb.Empty, error)
func (ProductService) ServiceInfo ¶
func (svc ProductService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInfoRequest) (*commonpb.ServiceInfoResponse, error)
func (ProductService) ViewProduct ¶
func (svc ProductService) ViewProduct(ctx context.Context, req *pb.ViewProductRequest) (*pb.ViewProductResponse, error)
func (ProductService) ViewProducts ¶
func (svc ProductService) ViewProducts(ctx context.Context, req *pb.ViewProductsRequest) (*pb.ViewProductsResponse, 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 { GetProduct(ctx context.Context, productId string) (*pb.Product, error) GetProducts(ctx context.Context) ([]*pb.Product, error) UpdateProductPrice(ctx context.Context, productId string, price float32) (*pb.Product, error) DeleteProduct(ctx context.Context, productId string) error PriceOrderProducts(ctx context.Context, orderId string, customerId string, productQuantities map[string]int32) 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.