models

package
v0.0.0-...-7f44f1c Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializeShoppingCart

func SerializeShoppingCart(s *ShoppingCart) []byte

Types

type Car

type Car struct {
	ModelName    string
	Color        string
	Manufacturer string
}

type ContactRequest

type ContactRequest struct {
	FirstName string
	LastName  string
	Email     string
	Message   string
}

type Gopher

type Gopher struct {
	Name      string
	Title     string
	Biodata   string
	ImageURI  string
	StartTime time.Time
}

type Product

type Product struct {
	SKU                 string
	Name                string
	Description         string
	ThumbnailPreviewURI string
	ImagePreviewURI     string
	Price               float64
	Route               string
	SummaryDetail       string
	Quantity            int
}

type Products

type Products []*Product

func (Products) Len

func (p Products) Len() int

func (Products) Less

func (p Products) Less(i, j int) bool

func (Products) Swap

func (p Products) Swap(i, j int)

type ShoppingCart

type ShoppingCart struct {
	Items map[string]*ShoppingCartItem `json:"items"`
}

func NewShoppingCart

func NewShoppingCart() *ShoppingCart

func UnserializeShoppingCart

func UnserializeShoppingCart(jsonData []byte) *ShoppingCart

func (*ShoppingCart) AddItem

func (s *ShoppingCart) AddItem(sku string)

func (*ShoppingCart) IsEmpty

func (s *ShoppingCart) IsEmpty() bool

func (*ShoppingCart) ItemTotal

func (s *ShoppingCart) ItemTotal() int

func (*ShoppingCart) RemoveItem

func (s *ShoppingCart) RemoveItem(sku string) bool

func (*ShoppingCart) UpdateItemQuantity

func (s *ShoppingCart) UpdateItemQuantity(sku string, quantity int) bool

type ShoppingCartItem

type ShoppingCartItem struct {
	ProductSKU string `json:"productSKU"`
	Quantity   int    `json:"quantity"`
}

Jump to

Keyboard shortcuts

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