model

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjective

type Adjective struct {
	bun.BaseModel
	Name string `json:"name" bun:",pk"`
}

type ClassicalName

type ClassicalName struct {
	bun.BaseModel
	Name string `json:"name" bun:",pk"`
}

type Dough

type Dough struct {
	bun.BaseModel
	ID               int64  `bun:",pk"`
	Name             string `json:"name"`
	CaloriesPerSlice int    `json:"caloriesPerSlice"`
}

type Ingredient

type Ingredient struct {
	bun.BaseModel    `bun:"table:ingredients,alias:i"`
	ID               int64  `bun:",pk"`
	Name             string `json:"name"`
	CaloriesPerSlice int    `json:"caloriesPerSlice"`
	Vegetarian       bool   `json:"vegetarian"`
	Type             string `json:"-"`
}

type Pizza

type Pizza struct {
	ID          int64        `bun:",pk,autoincrement"`
	CreatedAt   time.Time    `json:"-" bun:",nullzero,notnull,default:current_timestamp"`
	Name        string       `json:"name"`
	DoughID     int64        `json:"-"`
	Dough       Dough        `json:"dough" bun:"rel:belongs-to,join:dough_id=id"`
	Ingredients []Ingredient `json:"ingredients" bun:"m2m:pizza_to_ingredients,join:Pizza=Ingredient"`
	Tool        string       `json:"tool"`
}

func (Pizza) CalculateCalories

func (p Pizza) CalculateCalories() int

func (Pizza) IsVegetarian

func (p Pizza) IsVegetarian() bool

type PizzaToIngredients

type PizzaToIngredients struct {
	PizzaID      int64       `bun:",pk"`
	Pizza        *Pizza      `bun:"rel:belongs-to,join:pizza_id=id"`
	IngredientID int64       `bun:",pk"`
	Ingredient   *Ingredient `bun:"rel:belongs-to,join:ingredient_id=id"`
}

type Quote

type Quote struct {
	bun.BaseModel
	Name string `json:"name" bun:",pk"`
}

type Tool

type Tool struct {
	bun.BaseModel
	Name string `json:"name" bun:",pk"`
}

Jump to

Keyboard shortcuts

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