adding

package
Version: v0.0.0-...-bc4fcfc Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: MIT Imports: 2 Imported by: 10

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

Source Files

Jump to

Keyboard shortcuts

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