models

package
v0.0.0-...-ee5a250 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type Categories

type Categories []Category
var CategorySlice Categories

func ListCategories

func ListCategories() (*Categories, error)

ListCategory

type Category

type Category struct {
	ID         string   `json:"id"`
	Name       string   `json:"name"`
	ListOrder  int64    `json:"list_order"`
	ProductIDs []string `json:"product_ids"`
}

Category structure

func GetCategory

func GetCategory(id string) (*Category, error)

GetCategory

func (*Category) Create

func (category *Category) Create() (*Category, error)

CreateCategory

func (*Category) Delete

func (category *Category) Delete() error

DeleteCategory

func (*Category) Update

func (category *Category) Update() (*Category, error)

UpdateCategory

type Choice

type Choice struct {
	ID         string  `json:"id"`
	CategoryID string  `json:"category_id"`
	ProductID  string  `json:"product_id"`
	OptionID   string  `json:"option_id"`
	Name       string  `json:"name,omitempty"`
	ListOrder  int64   `json:"list_order,omitempty"`
	Price      float64 `json:"price,omitempty"`
}

func GetChoice

func GetChoice(choiceID string) (*Choice, error)

type Choices

type Choices []Choice
var ChoiceSlice Choices

func ListChoices

func ListChoices(categoryID, productID, optionID string) (*Choices, error)

ListChoices

type Option

type Option struct {
	ID         string           `json:"id"`
	CategoryID string           `json:"category_id"`
	ProductID  string           `json:"product_id"`
	Name       string           `json:"name,omitempty"`
	ListOrder  int64            `json:"list_order,omitempty"`
	Required   bool             `json:"required,omitempty"`
	ChoiceType OptionChoiceType `json:"choice_type,omitempty"`
}

func GetOption

func GetOption(optionID string) (*Option, error)

GetOption

func (*Option) Update

func (option *Option) Update() (*Option, error)

UpdateOptions

type OptionChoiceType

type OptionChoiceType string
const (
	// OptionChoiceTypeSingle should used for single choices
	OptionChoiceTypeSingle OptionChoiceType = "single"
	// OptionChoiceTypeMultiple should used for multiple choices
	OptionChoiceTypeMultiple OptionChoiceType = "multiple"
)

type Options

type Options []Option
var OptionSlice Options

func ListOptions

func ListOptions(categoryID string, productID string) (*Options, error)

ListOptions

type Product

type Product struct {
	ID         string   `json:"id"`
	Name       string   `json:"name"`
	ListOrder  int64    `json:"list_order"`
	OptionIDs  []string `json:"option_ids"`
	CategoryID string   `json:"category_id"`
	Price      float64  `json:"price"`
}

Product structure

func GetProduct

func GetProduct(productID, categoryID string) (*Product, error)

GetProduct

func (*Product) Create

func (product *Product) Create() (*Product, error)

CreateProduct

func (*Product) Delete

func (product *Product) Delete() error

DeleteProduct

func (*Product) Update

func (product *Product) Update() (*Product, error)

UpdateProduct

type Products

type Products []Product
var ProductSlice Products

func ListProducts

func ListProducts(categoryID string) (*Products, error)

ListProducts

Jump to

Keyboard shortcuts

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