drink

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 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 CopyDrinkResponse added in v0.12.0

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

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 DrinkAlreadyExistsError added in v0.14.0

type DrinkAlreadyExistsError struct {
	DrinkId int64
	Msg     string
}

func (DrinkAlreadyExistsError) Error added in v0.14.0

func (e DrinkAlreadyExistsError) Error() string

type DrinkData added in v0.7.0

type DrinkData struct {
	Name             string   `json:"name" validate:"required" strugen:"read,write"`
	PrimaryAlcohol   string   `json:"primary_alcohol" validate:"required" strugen:"read,write"`
	PreferredGlass   string   `json:"preferred_glass,omitempty" strugen:"read,write"`
	Ingredients      []string `json:"ingredients" validate:"required" strugen:"read,write"`
	Instructions     string   `json:"instructions,omitempty" strugen:"read,write"`
	Notes            string   `json:"notes,omitempty" strugen:"read,write"`
	Publicity        string   `json:"publicity" validate:"required" strugen:"read,write"`
	UnderDevelopment bool     `json:"under_development" strugen:"read,write"`
	Tags             []string `json:"tags" strugen:"read,write"`
	Favorite         bool     `json:"favorite" strugen:"read,write"`
}

func (DrinkData) GetFavorite added in v0.17.0

func (t DrinkData) GetFavorite() bool

Generated accessor for DrinkData

func (DrinkData) GetIngredients added in v0.7.0

func (t DrinkData) GetIngredients() []string

func (DrinkData) GetInstructions added in v0.7.0

func (t DrinkData) GetInstructions() string

func (DrinkData) GetName added in v0.7.0

func (t DrinkData) GetName() string

func (DrinkData) GetNotes added in v0.7.0

func (t DrinkData) GetNotes() string

func (DrinkData) GetPreferredGlass added in v0.7.0

func (t DrinkData) GetPreferredGlass() string

func (DrinkData) GetPrimaryAlcohol added in v0.7.0

func (t DrinkData) GetPrimaryAlcohol() string

func (DrinkData) GetPublicity added in v0.7.0

func (t DrinkData) GetPublicity() string

func (DrinkData) GetTags added in v0.16.0

func (t DrinkData) GetTags() []string

func (DrinkData) GetUnderDevelopment added in v0.15.0

func (t DrinkData) GetUnderDevelopment() bool

func (*DrinkData) SetFavorite added in v0.17.0

func (t *DrinkData) SetFavorite(v bool)

func (*DrinkData) SetIngredients added in v0.7.0

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

func (*DrinkData) SetInstructions added in v0.7.0

func (t *DrinkData) SetInstructions(v string)

func (*DrinkData) SetName added in v0.7.0

func (t *DrinkData) SetName(v string)

func (*DrinkData) SetNotes added in v0.7.0

func (t *DrinkData) SetNotes(v string)

func (*DrinkData) SetPreferredGlass added in v0.7.0

func (t *DrinkData) SetPreferredGlass(v string)

func (*DrinkData) SetPrimaryAlcohol added in v0.7.0

func (t *DrinkData) SetPrimaryAlcohol(v string)

func (*DrinkData) SetPublicity added in v0.7.0

func (t *DrinkData) SetPublicity(v string)

func (*DrinkData) SetTags added in v0.16.0

func (t *DrinkData) SetTags(v []string)

func (*DrinkData) SetUnderDevelopment added in v0.15.0

func (t *DrinkData) SetUnderDevelopment(v bool)

type DrinkDataGetter

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

type DrinkDataOperator

type DrinkDataOperator interface {
	DrinkDataSetter
	DrinkDataGetter
}

type DrinkDataSetter

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

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"`
	UnderDevelopment int    `db:"under_development" fieldtag:"required_insert"`
	Tags             string `db:"tags" fieldtag:"required_insert"`
	Favorite         int    `db:"favorite" 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