Documentation ¶
Index ¶
- type Repository
- func (repository *Repository) AddProduct(ID string, data string) error
- func (repository *Repository) CreateTable() error
- func (repository *Repository) DropTable() error
- func (repository *Repository) Exists() (bool, error)
- func (repository *Repository) GetAllProducts() ([]ec.ProductDTO, error)
- func (repository *Repository) GetProductByID(ID string) (ec.ProductDTO, error)
- func (repository *Repository) RemoveProductByID(ID string) error
- func (repository *Repository) UpdateProductDataByID(ID string, newData string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository holds a client of database.
func NewRepository ¶
func NewRepository(db *db.Database) *Repository
NewRepository creates new Products Repository.
func (*Repository) AddProduct ¶
func (repository *Repository) AddProduct(ID string, data string) error
AddProduct adds new product to database.
func (*Repository) CreateTable ¶
func (repository *Repository) CreateTable() error
CreateTable creates products table in database.
func (*Repository) DropTable ¶
func (repository *Repository) DropTable() error
DropTable drops products table.
func (*Repository) Exists ¶
func (repository *Repository) Exists() (bool, error)
Exists checks if table products exists.
func (*Repository) GetAllProducts ¶
func (repository *Repository) GetAllProducts() ([]ec.ProductDTO, error)
GetAllProducts returns all products from database.
func (*Repository) GetProductByID ¶
func (repository *Repository) GetProductByID(ID string) (ec.ProductDTO, error)
GetProductByID returns ProductDTO object with its data from database.
func (*Repository) RemoveProductByID ¶
func (repository *Repository) RemoveProductByID(ID string) error
RemoveProductByID from products table.
func (*Repository) UpdateProductDataByID ¶
func (repository *Repository) UpdateProductDataByID(ID string, newData string) error
UpdateProductDataByID using information fetched from EC.
Click to show internal directories.
Click to hide internal directories.