models

package
v0.0.0-...-96ff6bb Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const IngredientTable = "ingredients"
View Source
const ProductIngredientTable = "products_ingredients"
View Source
const ProductSourcingValueTable = "products_sourcing_values"
View Source
const ProductTable = "products"
View Source
const SourcingValueTable = "sourcing_values"

Variables

This section is empty.

Functions

This section is empty.

Types

type Ingredient

type Ingredient struct {
	ID   int    `gorm:"primary_key" json:"ingredient_id"`
	Name string `gorm:"not null" json:"name"`
}

func (Ingredient) TableName

func (Ingredient) TableName() string

type Product

type Product struct {
	ID          string `gorm:"primary_key" json:"product_id"`
	Name        string `gorm:"not null" json:"name"`
	ImageOpen   string `json:"image_open"`
	ImageClosed string `json:"image_closed"`
	Description string `json:"description"`
	Story       string `gorm:"not null" json:"story"`

	AllergyInfo           string `json:"allergy_info"`
	DietaryCertifications string `json:"dietary_certifications"`

	SourcingValues []SourcingValue `gorm:"many2many:products_sourcing_values" json:"sourcing_values"`
	Ingredients    []Ingredient    `gorm:"many2many:products_ingredients" json:"ingredients"`
}

func (Product) TableName

func (Product) TableName() string

func (Product) ToModel

func (p Product) ToModel() view_models.ProductModel

type ProductIngredient

type ProductIngredient struct {
	ProductID    string `gorm:"primary_key" json:"product_id"`
	IngredientID int    `gorm:"primary_key" json:"ingredient_id"`
}

func (ProductIngredient) TableName

func (ProductIngredient) TableName() string

type ProductSourcingValue

type ProductSourcingValue struct {
	ProductID       string `gorm:"primary_key" json:"product_id"`
	SourcingValueID int    `gorm:"primary_key" json:"sourcing_value_id"`
}

func (ProductSourcingValue) TableName

func (ProductSourcingValue) TableName() string

type SourcingValue

type SourcingValue struct {
	ID   int    `gorm:"primary_key" json:"id"`
	Name string `gorm:"not null" json:"name"`
}

func (SourcingValue) TableName

func (SourcingValue) TableName() string

type User

type User struct {
	ID             int    `gorm:"primary_key" json:"id"`
	Username       string `gorm:"unique; not null"`
	DisplayName    string `gorm:"not null" json:"display_name"`
	HashedPassword string `gorm:"not null" json:"-"`
}

func (*User) ComparePassword

func (u *User) ComparePassword(plainPassword string) bool

Jump to

Keyboard shortcuts

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