models

package
v0.0.0-...-07d1ea4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPrereqForDrink

func CheckPrereqForDrink(name string) (bool, float64, error)

func CheckPrereqForMoney

func CheckPrereqForMoney(d Denomination, cost float64) (bool, Denomination, Denomination, error)

func ConsumeDrink

func ConsumeDrink(name string) (bool, error)

func GetAvailableDrinks

func GetAvailableDrinks() map[string]Drink

func GetAvailableDrinksName

func GetAvailableDrinksName() []string

func GetDenominationValueByName

func GetDenominationValueByName(denomination string) (string, error)

func GetIngredienteValueByName

func GetIngredienteValueByName(ingredient string) (string, error)

func RemoveDrink

func RemoveDrink(name string) (bool, error)

Types

type Denomination

type Denomination struct {
	Half  int
	One   int
	Two   int
	Five  int
	Ten   int
	Total float64
}

func CalculateDenominationAfterConsume

func CalculateDenominationAfterConsume(d Denomination, cost float64) (Denomination, error)

func CleanupDenominations

func CleanupDenominations() (Denomination, error)

func GetCurrentMoney

func GetCurrentMoney() *Denomination

func InitializeDenominations

func InitializeDenominations(d Denomination) (Denomination, error)

func UpdateDenominationConsume

func UpdateDenominationConsume(d Denomination, cost float64) (Denomination, error)

func UpdateDenominationPatch

func UpdateDenominationPatch(d Denomination) (Denomination, error)

func UpdateDenominationPut

func UpdateDenominationPut(d Denomination) (Denomination, error)

func UpdateDenominationValueByName

func UpdateDenominationValueByName(denomination string, value int) (Denomination, error)

func (*Denomination) CalculateTotal

func (d *Denomination) CalculateTotal()

func (*Denomination) ConvertDenominationToDenominationDB

func (denomination *Denomination) ConvertDenominationToDenominationDB(tenantName string) DenominationDB

func (*Denomination) ValidationDenomination

func (d *Denomination) ValidationDenomination() (bool, error)

type DenominationDB

type DenominationDB struct {
	gorm.Model
	TenantName string `gorm:"type:varchar(60);uniqueIndex"`
	Half       int
	One        int
	Two        int
	Five       int
	Ten        int
	Total      float64
}

func (*DenominationDB) CalculateTotal

func (d *DenominationDB) CalculateTotal()

func (*DenominationDB) ConvertDenominationDBToDenomination

func (denominationDB *DenominationDB) ConvertDenominationDBToDenomination() Denomination

type Drink

type Drink struct {
	Water       uint16
	Milk        uint16
	Sugar       uint16
	CoffeeBeans uint16
	TeaBeans    uint16
	Cups        uint16
	Money       float64
}

func AddDrink

func AddDrink(name string, drink Drink) (Drink, error)

func GetDrinkByName

func GetDrinkByName(name string) Drink

func (*Drink) ConvertDrinkToDB

func (drink *Drink) ConvertDrinkToDB(name string, tenantnName string) DrinkDB

func (*Drink) ValidationDrink

func (drink *Drink) ValidationDrink() (bool, error)

type DrinkDB

type DrinkDB struct {
	gorm.Model
	Name        string `gorm:"type:varchar(60);uniqueIndex:idx_name_tenantname"`
	TenantName  string `gorm:"type:varchar(60);uniqueIndex:idx_name_tenantname"`
	Water       uint16
	Milk        uint16
	Sugar       uint16
	CoffeeBeans uint16
	TeaBeans    uint16
	Cups        uint16
	Money       float64
}

func (*DrinkDB) CheckResourcePrereqForDrinkDB

func (dbDrink *DrinkDB) CheckResourcePrereqForDrinkDB() (bool, float64, Ingredient, error)

func (*DrinkDB) ConsumeDrinkDB

func (dbDrink *DrinkDB) ConsumeDrinkDB() (bool, error)

func (*DrinkDB) ConvertDrinkDBToDrink

func (dbDrink *DrinkDB) ConvertDrinkDBToDrink() Drink

type Ingredient

type Ingredient struct {
	Water       uint16
	Milk        uint16
	Sugar       uint16
	CoffeeBeans uint16
	TeaBeans    uint16
	Cups        uint16
}

func CleanupIngredients

func CleanupIngredients() (Ingredient, error)

func GetMachineIngredients

func GetMachineIngredients() *Ingredient

func InitializeIngredients

func InitializeIngredients(ing Ingredient) (Ingredient, error)

func UpdateIngredientPatch

func UpdateIngredientPatch(ing Ingredient) (Ingredient, error)

func UpdateIngredientPut

func UpdateIngredientPut(ing Ingredient) (Ingredient, error)

func UpdateIngredientValueByName

func UpdateIngredientValueByName(ingredient string, value uint16) (Ingredient, error)

func (*Ingredient) ConvertIngredientToIngredientDB

func (ingredient *Ingredient) ConvertIngredientToIngredientDB(tenantName string) IngredientDB

func (*Ingredient) ValidationIngredient

func (ing *Ingredient) ValidationIngredient() (bool, error)

type IngredientDB

type IngredientDB struct {
	gorm.Model
	TenantName  string `gorm:"type:varchar(60);uniqueIndex"`
	Water       uint16
	Milk        uint16
	Sugar       uint16
	CoffeeBeans uint16
	TeaBeans    uint16
	Cups        uint16
}

func (*IngredientDB) ConvertIngredientDBToIngredient

func (ingredientDB *IngredientDB) ConvertIngredientDBToIngredient() Ingredient

Jump to

Keyboard shortcuts

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