Documentation ¶
Index ¶
- type Cart
- type CartController
- type CartItem
- type CartRepo
- func (cr *CartRepo) CreateCart(cart *Cart) error
- func (cr *CartRepo) DeleteCart(filter interface{}, opts ...*options.DeleteOptions) error
- func (cr *CartRepo) GetCart(filter interface{}, opts ...*options.FindOneOptions) (*Cart, error)
- func (cr *CartRepo) GetCarts(filter interface{}, opts ...*options.FindOptions) ([]*Cart, error)
- func (cr *CartRepo) UpdateCart(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
- type CartRepository
- type CartService
- type CartServices
- type ItemRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cart ¶
type Cart struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` UserID primitive.ObjectID `json:"user_id" bson:"user_id,omitempty"` CartItems []CartItem `json:"cart_items" bson:"cart_items"` TotalPrice float64 `json:"total_price" bson:"total_price"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
type CartController ¶
type CartController struct {
// contains filtered or unexported fields
}
func NewCartController ¶
func NewCartController(cartServices CartServices) *CartController
func (*CartController) GetCart ¶
func (cc *CartController) GetCart(c *gin.Context)
func (*CartController) UpdateCart ¶
func (cc *CartController) UpdateCart(c *gin.Context)
type CartRepo ¶
type CartRepo struct {
Collection *mongo.Collection
}
func NewCartRepo ¶
func NewCartRepo(collection *mongo.Collection) *CartRepo
func (*CartRepo) CreateCart ¶
func (*CartRepo) DeleteCart ¶
func (cr *CartRepo) DeleteCart(filter interface{}, opts ...*options.DeleteOptions) error
func (*CartRepo) GetCart ¶
func (cr *CartRepo) GetCart(filter interface{}, opts ...*options.FindOneOptions) (*Cart, error)
func (*CartRepo) GetCarts ¶
func (cr *CartRepo) GetCarts(filter interface{}, opts ...*options.FindOptions) ([]*Cart, error)
func (*CartRepo) UpdateCart ¶
func (cr *CartRepo) UpdateCart(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
type CartRepository ¶
type CartRepository interface { CreateCart(cart *Cart) error UpdateCart(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error GetCart(filter interface{}, opts ...*options.FindOneOptions) (*Cart, error) GetCarts(filter interface{}, opts ...*options.FindOptions) ([]*Cart, error) }
type CartService ¶
type CartService struct {
// contains filtered or unexported fields
}
func NewCartService ¶
func NewCartService(cartRepository CartRepository, itemRepository ItemRepository) *CartService
func (*CartService) RemoveFromCart ¶
type CartServices ¶
type ItemRepository ¶
type ItemRepository interface { GetItem(filter interface{}, opts ...*options.FindOneOptions) (*item.Item, error) UpdateItem(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error }
Click to show internal directories.
Click to hide internal directories.