pizza

package
v0.0.0-...-a6a62f5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: CC-BY-SA-4.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base string
const (
	Sugo  Base = "sugo"
	Cream Base = "cream"
)

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder is a traditional builder pattern as you know it.

func NewBuilder

func NewBuilder() *Builder

func (*Builder) AddTopping

func (b *Builder) AddTopping(topping Topping) *Builder

func (*Builder) Build

func (b *Builder) Build() (pizza *Pizza, err error)

func (*Builder) SetBase

func (b *Builder) SetBase(base Base) *Builder

func (*Builder) SetSize

func (b *Builder) SetSize(size Size) *Builder

type Pizza

type Pizza struct {
	Base     Base
	Size     Size
	Toppings []Topping
}

func MakeHawaiPizza

func MakeHawaiPizza() (pizza *Pizza, err error)

makeHawaiPizza creates a hawai pizza. Its sole purpose is to demonstrate the traditional builder usage. But man, hawai? Seriously? From all the pizzas you chose hawai?

type Size

type Size string
const (
	Regular Size = "32cm"
	Large   Size = "40cm"
)

type Topping

type Topping string
const (
	Prosciutto Topping = "prosciutto"
	Salami     Topping = "salami"
	Ham        Topping = "ham"
	Pineapple  Topping = "pineapple" // Do not even think about it
)

Jump to

Keyboard shortcuts

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