Documentation
¶
Overview ¶
Package service contains the gRPC Order microservice implementation.
Index ¶
- Variables
- func PiiHashString(value string) string
- type OrderService
- func (os *OrderService) GetOrderByID(ctx context.Context, req *pborder.GetOrderByIDRequest) (*pborder.GetOrderByIDResponse, error)
- func (os *OrderService) GetOrders(ctx context.Context, req *pborder.GetOrdersRequest) (*pborder.GetOrdersResponse, error)
- func (os *OrderService) SaveOrder(ctx context.Context, order *schema.Order) error
Constants ¶
This section is empty.
Variables ¶
var ( // ProjectId is a variable so that unit tests can override it to ensures that test requests are not routed to // the live project! See https://firebase.google.com/doos/emulator-suite/connect_firestore ProjectId string // UnitTestNewOrderServiceError should be returned by NewOrderService if we are running unit tests // and unitTestNewOrderServiceError is not nil. UnitTestNewOrderServiceError error // PiiHash is the salt used by the PiiHashString function when rendering a PII string value into // a sufficiently unique string to be reliably searched for in logs without exposing the PII itself as // plain text. PiiHash hash.Hash )
Functions ¶
func PiiHashString ¶
PiiHashString renders a string PII value as a truncated base64 salted hash that can be safely rendered in logs to support searching without exposing PII values such as name and address as plain text.
Types ¶
type OrderService ¶
type OrderService struct { pborder.UnimplementedOrderAPIServer // FsClient is the GCP Firestore client - it is thread safe and can be reused concurrently FsClient *firestore.Client // contains filtered or unexported fields }
OrderService is a structure class with methods that implements the order.OrderAPIServer gRPC API storing the data for orders in a Google Cloud Firestore document collection.
func NewOrderService ¶
func NewOrderService() (*OrderService, error)
NewOrderService is a factory method returning an instance of our shopping cart service.
func (*OrderService) GetOrderByID ¶
func (os *OrderService) GetOrderByID(ctx context.Context, req *pborder.GetOrderByIDRequest) (*pborder.GetOrderByIDResponse, error)
GetOrderByID retrieves an order matching the specified UUID ID in the pborder.GetOrderByIDRequest.
func (*OrderService) GetOrders ¶
func (os *OrderService) GetOrders(ctx context.Context, req *pborder.GetOrdersRequest) (*pborder.GetOrdersResponse, error)
GetOrders retrieves a page of orders matching the search criteria specified UUID ID in the pborder.GetOrdersRequest.