cart

package
v0.0.0-...-cf457fc Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2018 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CartNotFoundErr = errors.New("cart not found")

Functions

This section is empty.

Types

type Cart

type Cart struct {
	Key      string            `json:"key"`
	Shipping float64           `json:"shipping"`
	Products []product.Product `json:"products"`
}

Cart stores the cart

func New

func New(key string) *Cart

func (*Cart) AddProduct

func (c *Cart) AddProduct(product product.Product)

AddItem adds a new item in the cart

func (*Cart) Quantity

func (c *Cart) Quantity() int

Quantity returns the item quantity in the cart

func (*Cart) RemoveProduct

func (c *Cart) RemoveProduct(index int)

RemoveItem remove an item from the cart

func (*Cart) Total

func (c *Cart) Total() float64

Total returns the total

type CartStorage

type CartStorage interface {
	GetCart(id string) (*Cart, error)
	SaveCart(c *Cart) error
}

Jump to

Keyboard shortcuts

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