carts

package
v0.0.0-...-769f8fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteProductFromCart

func DeleteProductFromCart(w http.ResponseWriter, r *http.Request)

func GetCart

func GetCart(w http.ResponseWriter, r *http.Request)

func PutProductQuantity

func PutProductQuantity(w http.ResponseWriter, r *http.Request)

Types

type Cart

type Cart struct {
	Id        string              `json:"id"`
	Items     map[string]CartItem `json:"items"`
	CreatedAt time.Time           `json:"createdAt"`
	UpdatedAt time.Time           `json:"updatedAt"`
}

func (Cart) AddProduct

func (cart Cart) AddProduct(sku string, cartItem CartItem) Cart

func (*Cart) RemoveProduct

func (cart *Cart) RemoveProduct(sku string)

type CartItem

type CartItem struct {
	Quantity int64 `json:"quantity"`
}

type Usecases

type Usecases struct{}

func (Usecases) DeleteCart

func (u Usecases) DeleteCart(id string) error

func (Usecases) DeleteProductFromCart

func (u Usecases) DeleteProductFromCart(id, sku string) (Cart, error)

func (Usecases) GetCartById

func (u Usecases) GetCartById(id string) (Cart, error)

func (Usecases) PutProductQuantity

func (u Usecases) PutProductQuantity(id, sku string, cartItem CartItem) (Cart, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL