albums

package
v0.0.0-...-92a4d77 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adder

type Adder interface {
	Add(newAlbum Album)
}

type Album

type Album struct {
	ID     string  `json:"id"`
	Title  string  `json:"title"`
	Artist string  `json:"artist"`
	Price  float64 `json:"price"`
}

type DbRepo

type DbRepo struct {
	DB     *sql.DB
	Albums []Album
}

func NewDbRepo

func NewDbRepo(ConnectionString string) *DbRepo

func (*DbRepo) Add

func (r *DbRepo) Add(newAlbum Album)

func (*DbRepo) GetAll

func (r *DbRepo) GetAll() []Album

func (*DbRepo) GetById

func (r *DbRepo) GetById(id string) (*Album, error)

func (*DbRepo) RemoveById

func (r *DbRepo) RemoveById(id string) error

type Getter

type Getter interface {
	GetAll() []Album
}

type GetterById

type GetterById interface {
	GetById(id string) (*Album, error)
}

type Remover

type Remover interface {
	RemoveById(id string) error
}

type Repo

type Repo struct {
	Albums []Album
}

func NewInMemoryRepo

func NewInMemoryRepo() *Repo

func (*Repo) Add

func (r *Repo) Add(newAlbum Album)

func (*Repo) GetAll

func (r *Repo) GetAll() []Album

func (*Repo) GetById

func (r *Repo) GetById(id string) (*Album, error)

func (*Repo) RemoveById

func (r *Repo) RemoveById(id string) error

Jump to

Keyboard shortcuts

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