memory

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: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beer

type Beer struct {
	ID        int
	Name      string
	Brewery   string
	Abv       float32
	ShortDesc string
	Created   time.Time
}

Beer defines the properties of a beer to be listed

type Review

type Review struct {
	ID        string
	BeerID    int
	FirstName string
	LastName  string
	Score     int
	Text      string
	Created   time.Time
}

Review defines a beer review

type Storage

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

Memory storage keeps data in memory

func (*Storage) AddBeer

func (m *Storage) AddBeer(b adding.Beer) error

Add saves the given beer to the repository

func (*Storage) AddReview

func (m *Storage) AddReview(r reviewing.Review) error

Add saves the given review in the repository

func (*Storage) GetAllBeers

func (m *Storage) GetAllBeers() []listing.Beer

GetAll return all beers

func (*Storage) GetAllReviews

func (m *Storage) GetAllReviews(beerID int) []listing.Review

GetAll returns all reviews for a given beer

func (*Storage) GetBeer

func (m *Storage) GetBeer(id int) (listing.Beer, error)

Get returns a beer with the specified ID

Jump to

Keyboard shortcuts

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