adding

package
v0.0.0-...-63f3735 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBeers = []Beer{
	{
		Name:    "Pliny the Elder",
		Brewery: "Russian River Brewing Company",
		Abv:     8,
		ShortDesc: "Pliny the Elder is brewed with Amarillo, " +
			"Centennial, CTZ, and Simcoe hops. It is well-balanced with " +
			"malt, hops, and alcohol, slightly bitter with a fresh hop " +
			"aroma of floral, citrus, and pine.",
	},
	{
		Name:    "Oatmeal Stout",
		Brewery: "Samuel Smith",
		Abv:     5,
		ShortDesc: "Brewed with well water (the original well at the " +
			"Old Brewery, sunk in 1758, is still in use, with the hard well " +
			"water being drawn from 85 feet underground); fermented in " +
			"‘stone Yorkshire squares’ to create an almost opaque, " +
			"wonderfully silky and smooth textured ale with a complex " +
			"medium dry palate and bittersweet finish.",
	},
	{
		Name:    "Märzen",
		Brewery: "Schlenkerla",
		Abv:     5,
		ShortDesc: "Bamberg's speciality, a dark, bottom fermented " +
			"smokebeer, brewed with Original Schlenkerla Smokemalt from " +
			"the Schlenkerla maltings and tapped according to old tradition " +
			"directly from the gravity-fed oakwood cask in the historical " +
			"brewery tavern.",
	},
	{
		Name:    "Duvel",
		Brewery: "Duvel Moortgat",
		Abv:     9,
		ShortDesc: "A Duvel is still seen as the reference among strong " +
			"golden ales. Its bouquet is lively and tickles the nose with an " +
			"element of citrus which even tends towards grapefruit thanks to " +
			"the use of only the highest-quality hop varieties.",
	},
	{
		Name:    "Negra",
		Brewery: "Modelo",
		Abv:     5,
		ShortDesc: "Brewed longer to enhance the flavors, this Munich " +
			"Dunkel-style Lager gives way to a rich flavor and remarkably " +
			"smooth taste.",
	},
	{
		Name:    "Guinness Draught",
		Brewery: "Guinness Ltd.",
		Abv:     4,
		ShortDesc: "Pours dark brown, almost black with solid lasting light brown head. " +
			"Aroma of bitter cocoa, light coffee and roasted malt. " +
			"Body is light sweet, medium bitter. " +
			"Body is light to medium, texture almost thin and carbonation average. " +
			"Finish is medium bitter cocoa with more pronounced roast flavor. Smooth drinker.",
	},
	{
		Name:    "XX Lager",
		Brewery: "Cuahutemoc Moctezuma",
		Abv:     4.2,
		ShortDesc: "A crisp, refreshing, light-bodied malt-flavored beer with a well-balanced finish. " +
			"A Lager that drinks like a Pilsner. A liquid embodiment of living life to the fullest. " +
			"A beverage made from pure spring water and the choicest hops. A beer with such good taste, it’s chosen you to drink it.",
	},
	{
		Name:    "Tecate",
		Brewery: "Cuahutemoc Moctezuma",
		Abv:     5,
		ShortDesc: "Very smooth, medium bodied brew. Malt sweetness is thin, and can be likened to diluted sugar water. " +
			"Touch of fructose-like sweetness. Light citric hop flavours gently prick the palate with tea-like notes that follow and fade quickly. " +
			"Finishes a bit dry with husk tannins and a pasty mouthfeel.",
	},
	{
		Name:    "Sol",
		Brewery: "Cuahutemoc Moctezuma",
		Abv:     5,
		ShortDesc: "While Corona wins the marketing wars in the U.S., Sol is the winning brand in much of Mexico, despite not being a standout in any respect. " +
			"You see the logo plastered everywhere and it’s seemingly on every restaurant and bar menu. Like Corona, it’s simple and inoffensive, " +
			"but still slightly more flavorful than your typical American macrobrew. At its best ice cold, and progressively worse as it gets warmer.",
	},
	{
		Name:    "Corona",
		Brewery: "Cuahutemoc Moctezuma",
		Abv:     5,
		ShortDesc: "One of the five best-selling beers in the world, but it usually tastes better in Mexico, " +
			"where the bottles don’t have so much time in transit and on shelves. (Sunlight coming through clear bottles is never a good thing for beer.) " +
			"This is the typical “drink all afternoon” beer, working well on its own or with a plate of tacos. Refreshing with a lime.",
	},
}
View Source
var ErrDuplicate = errors.New("beer already exists")

Functions

This section is empty.

Types

type Beer

type Beer struct {
	Name      string  `json:"name"`
	Brewery   string  `json:"brewery"`
	Abv       float32 `json:"abv"`
	ShortDesc string  `json:"short_description"`
}

Beer defines the properties of a beer to be added

type Event

type Event int

Event defines possible outcomes from the "adding actor"

const (
	// Done means finished processing successfully
	Done Event = iota

	// BeerAlreadyExists means the given beer is a duplicate of an existing one
	BeerAlreadyExists

	// Failed means processing did not finish successfully
	Failed
)

func (Event) GetMeaning

func (e Event) GetMeaning() string

type Payload

type Payload []Beer

type Repository

type Repository interface {
	// AddBeer saves a given beer to the repository.
	AddBeer(Beer) error
}

Repository provides access to beer repository.

type Service

type Service interface {
	AddBeer(...Beer)
	AddSampleBeers(Payload) <-chan Event
}

Service provides beer adding operations.

func NewService

func NewService(r Repository) Service

NewService creates an adding service with the necessary dependencies

Jump to

Keyboard shortcuts

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