drink

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DrinkPublicityPublic  = "public"
	DrinkPublicityPrivate = "private"
)
View Source
const (
	TableName = "drink"
)

Variables

View Source
var ModelStruct = sqlbuilder.NewStruct(new(Model))

Functions

func Init

func Init(app *fiber.App, db *sql.DB) error

Types

type CreateDrinkRequest

type CreateDrinkRequest struct {
	DrinkData
}

type CreateDrinkResponse

type CreateDrinkResponse struct {
	ID int64 `json:"id,omitempty"`
}

type DeleteDrinkResponse

type DeleteDrinkResponse struct {
	Success bool `json:"success"`
}

type Drink

type Drink struct {
	ID       int64  `json:"id"`
	Username string `json:"username" validate:"required"`
	DrinkData
}

type DrinkData added in v0.7.0

type DrinkData struct {
	Name           string   `json:"name" validate:"required"`
	PrimaryAlcohol string   `json:"primary_alcohol" validate:"required"`
	PreferredGlass string   `json:"preferred_glass,omitempty"`
	Ingredients    []string `json:"ingredients" validate:"required"`
	Instructions   string   `json:"instructions,omitempty"`
	Notes          string   `json:"notes,omitempty"`
	Publicity      string   `json:"publicity" validate:"required"`
}

func (DrinkData) GetIngredients added in v0.7.0

func (d DrinkData) GetIngredients() []string

func (DrinkData) GetInstructions added in v0.7.0

func (d DrinkData) GetInstructions() string

func (DrinkData) GetName added in v0.7.0

func (d DrinkData) GetName() string

func (DrinkData) GetNotes added in v0.7.0

func (d DrinkData) GetNotes() string

func (DrinkData) GetPreferredGlass added in v0.7.0

func (d DrinkData) GetPreferredGlass() string

func (DrinkData) GetPrimaryAlcohol added in v0.7.0

func (d DrinkData) GetPrimaryAlcohol() string

func (DrinkData) GetPublicity added in v0.7.0

func (d DrinkData) GetPublicity() string

func (*DrinkData) SetIngredients added in v0.7.0

func (d *DrinkData) SetIngredients(v []string)

func (*DrinkData) SetInstructions added in v0.7.0

func (d *DrinkData) SetInstructions(v string)

func (*DrinkData) SetName added in v0.7.0

func (d *DrinkData) SetName(v string)

func (*DrinkData) SetNotes added in v0.7.0

func (d *DrinkData) SetNotes(v string)

func (*DrinkData) SetPreferredGlass added in v0.7.0

func (d *DrinkData) SetPreferredGlass(v string)

func (*DrinkData) SetPrimaryAlcohol added in v0.7.0

func (d *DrinkData) SetPrimaryAlcohol(v string)

func (*DrinkData) SetPublicity added in v0.7.0

func (d *DrinkData) SetPublicity(v string)

type DrinkDataGetter

type DrinkDataGetter interface {
	GetName() string
	GetPrimaryAlcohol() string
	GetPreferredGlass() string
	GetIngredients() []string
	GetInstructions() string
	GetNotes() string
	GetPublicity() string
}

type DrinkDataOperator

type DrinkDataOperator interface {
	DrinkDataSetter
	DrinkDataGetter
}

type DrinkDataSetter

type DrinkDataSetter interface {
	SetName(string)
	SetPrimaryAlcohol(string)
	SetPreferredGlass(string)
	SetIngredients([]string)
	SetInstructions(string)
	SetNotes(string)
	SetPublicity(string)
}

type GetDrinkResponse

type GetDrinkResponse struct {
	Drink *Drink `json:"drink"`
}

type GetDrinksByUserResponse

type GetDrinksByUserResponse struct {
	Success bool    `json:"success"`
	Drinks  []Drink `json:"drinks"`
}

type Model

type Model struct {
	ID             int64  `db:"id"`
	Name           string `db:"name" fieldtag:"required_insert"`
	Username       string `db:"username" fieldtag:"required_insert"`
	PrimaryAlcohol string `db:"primary_alcohol" fieldtag:"required_insert"`
	PreferredGlass string `db:"preferred_glass" fieldtag:"required_insert"`
	Ingredients    string `db:"ingredients" fieldtag:"required_insert"`
	Instructions   string `db:"instructions" fieldtag:"required_insert"`
	Notes          string `db:"notes" fieldtag:"required_insert"`
	Publicity      string `db:"publicity" fieldtag:"required_insert"`
}

type UpdateDrinkRequest

type UpdateDrinkRequest struct {
	DrinkData
}

type UpdateDrinkResponse

type UpdateDrinkResponse struct {
	Success bool `json:"success"`
}

Jump to

Keyboard shortcuts

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