Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockOrderRepository ¶
type MockOrderRepository struct { ErrorOnFindAll bool ErrorOnStart bool ErrorOnComplete bool Storage map[string]*Order CompleteCallCounter int }
MockOrderRepository will mock real database connection for testing purposes.
func (*MockOrderRepository) Complete ¶
func (o *MockOrderRepository) Complete(orderID string) (string, error)
type Order ¶
type Order struct { ID string `bson:"_id,omitempty"` UserID string `bson:"user_id,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` PaymentAmount float32 `bson:"payment_amount,omitempty"` Status orders_grpc.Order_OrderStatus `bson:"status,omitempty"` Products []Product `bson:"products,omitempty"` }
Order struct represents order.
func (Order) ConvertToGRPCModel ¶
func (o Order) ConvertToGRPCModel() *orders_grpc.Order
ConvertToGRPCModel converts order to grpc compatible struct.
type OrderList ¶
type OrderList []Order
func (OrderList) ConvertToGRPCModel ¶
func (o OrderList) ConvertToGRPCModel() []*orders_grpc.Order
type OrderRepository ¶
OrderRepository handles operations in Mongo.
func (*OrderRepository) Complete ¶
func (o *OrderRepository) Complete(orderID string) (string, error)
Complete updates status of given order id and returns userID.
type Product ¶
type Product struct { ID string `bson:"id,omitempty"` Title string `bson:"title,omitempty"` Description string `bson:"description,omitempty"` Image string `bson:"image,omitempty"` Price float32 `bson:"price,omitempty"` }
Product struct represents product.
func (Product) ConvertToGRPCModel ¶
func (p Product) ConvertToGRPCModel() *orders_grpc.Product
ConvertToGRPCModel converts product to grpc compatible struct.
Click to show internal directories.
Click to hide internal directories.