Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CollectionBeer identifier for the JSON collection of beers CollectionBeer = "beers" // CollectionReview identifier for the JSON collection of reviews CollectionReview = "reviews" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONBeerStorage ¶
type JSONBeerStorage struct {
// contains filtered or unexported fields
}
JSONBeerStorage stores beer data in JSON files
func NewJSONBeerStorage ¶
func NewJSONBeerStorage() (*JSONBeerStorage, error)
NewJSONBeerStorage returns a new JSON beer storage
func (*JSONBeerStorage) Add ¶
func (s *JSONBeerStorage) Add(b beers.Beer) error
Add saves the given beer to the repository
func (*JSONBeerStorage) Get ¶
func (s *JSONBeerStorage) Get(id int) (beers.Beer, error)
Get returns a beer with the specified ID
func (*JSONBeerStorage) GetAll ¶
func (s *JSONBeerStorage) GetAll() []beers.Beer
GetAll returns all beers
type JSONReviewStorage ¶
type JSONReviewStorage struct {
// contains filtered or unexported fields
}
JSONReviewStorage stores review data in JSON files
func NewJSONReviewStorage ¶
func NewJSONReviewStorage() (*JSONReviewStorage, error)
NewJSONReviewStorage returns a new JSON reviews storage
type MemoryBeerStorage ¶
type MemoryBeerStorage struct {
// contains filtered or unexported fields
}
Memory storage keeps beer data in memory
func (*MemoryBeerStorage) Add ¶
func (m *MemoryBeerStorage) Add(b beers.Beer) error
Add saves the given beer to the repository
func (*MemoryBeerStorage) Get ¶
func (m *MemoryBeerStorage) Get(id int) (beers.Beer, error)
Get returns a beer with the specified ID
func (*MemoryBeerStorage) GetAll ¶
func (m *MemoryBeerStorage) GetAll() []beers.Beer
GetAll return all beers
type MemoryReviewStorage ¶
type MemoryReviewStorage struct {
// contains filtered or unexported fields
}
Memory storage keeps review data in memory
Click to show internal directories.
Click to hide internal directories.