controllers

package
v0.0.0-...-09cfb61 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

package controllers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutesCoffeeMachine

func RegisterRoutesCoffeeMachine(router *gin.RouterGroup)

register route for coffeemachine in gin framework

func RegisterRoutesDenomination

func RegisterRoutesDenomination(router *gin.RouterGroup)

register route for coffeemachine in gin framework

func RegisterRoutesDrink

func RegisterRoutesDrink(router *gin.RouterGroup)

register route for drink in gin framework

func RegisterRoutesIngredients

func RegisterRoutesIngredients(router *gin.RouterGroup)

register route for /ingredient in gin framework

Types

type CoffeeMachine

type CoffeeMachine struct {
	Ingredients  Ingredient   `form:"Ingredients" json:"Ingredients"`
	Denomination Denomination `form:"Money" json:"Money" binding:"validateDenomination"`
}

used for initialization of CoffeeMachine

type Denomination

type Denomination struct {
	Half int `form:"Half" json:"Half" binding:"required_without_all=One Two Five Ten,validateDenomination"`
	One  int `form:"One" json:"One" binding:"required_without_all=Half Two Five Ten,validateDenomination"`
	Two  int `form:"Two" json:"Two" binding:"required_without_all=One Half Five Ten,validateDenomination"`
	Five int `form:"Five" json:"Five" binding:"required_without_all=One Two Half Ten,validateDenomination"`
	Ten  int `form:"Ten" json:"Ten" binding:"required_without_all=One Two Five Half,validateDenomination"`
}

type Drink

type Drink struct {
	Water       uint16  `form:"Water" json:"Water" binding:"required_without_all=Milk Sugar CoffeeBeans TeaBeans Cups Money"`
	Milk        uint16  `form:"Milk" json:"Milk" binding:"required_without_all=Water Sugar CoffeeBeans TeaBeans Cups Money"`
	Sugar       uint16  `form:"Sugar" json:"Sugar" binding:"required_without_all=Milk Water CoffeeBeans TeaBeans Cups Money"`
	CoffeeBeans uint16  `form:"CoffeeBeans" json:"CoffeeBeans" binding:"required_without_all=Milk Sugar Water TeaBeans Cups Money"`
	TeaBeans    uint16  `form:"TeaBeans" json:"TeaBeans" binding:"required_without_all=Milk Sugar CoffeeBeans Water Cups Money"`
	Cups        uint16  `form:"Cups" json:"Cups" binding:"required_without_all=Milk Sugar CoffeeBeans TeaBeans Water Money"`
	Money       float64 `form:"Money" json:"Money" binding:"required_without_all=Milk Sugar CoffeeBeans TeaBeans Cups Water"`
}

type Ingredient

type Ingredient struct {
	Water       uint16 `form:"Water" json:"Water"`
	Milk        uint16 `form:"Milk" json:"Milk"`
	Sugar       uint16 `form:"Sugar" json:"Sugar"`
	CoffeeBeans uint16 `form:"CoffeeBeans" json:"CoffeeBeans"`
	TeaBeans    uint16 `form:"TeaBeans" json:"TeaBeans"`
	Cups        uint16 `form:"Cups" json:"Cups"`
}

type Money

type Money struct {
	Half int `form:"Half" json:"Half"`
	One  int `form:"One" json:"One"`
	Two  int `form:"Two" json:"Two"`
	Five int `form:"Five" json:"Five"`
	Ten  int `form:"Ten" json:"Ten"`
}

Jump to

Keyboard shortcuts

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