products

package
v0.0.0-...-461d2ee Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

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