adding

package
v0.0.0-...-aa5bd6b Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = errors.New("beer already exists")

ErrDuplicate is used when a 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 Repository

type Repository interface {
	// AddBeer saves a given beer to the repository.
	AddBeer(Beer) error
	// GetAllBeers returns all beers saved in storage.
	GetAllBeers() []listing.Beer
}

Repository provides access to beer repository.

type Service

type Service interface {
	AddBeer(...Beer) error
	AddSampleBeers([]Beer)
}

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