hdb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HomeDB

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

func Get

func Get(db *sql.DB, productResolver product.Resolver) *HomeDB

func (*HomeDB) AddInventory

func (hdb *HomeDB) AddInventory(productId int, locationId int, amount int) error

func (*HomeDB) AddProductToInventoryByEan

func (hdb *HomeDB) AddProductToInventoryByEan(ean string) error

func (*HomeDB) CreateProductCategory

func (hdb *HomeDB) CreateProductCategory(categoryName string) error

func (*HomeDB) DecrementFromInventoryByEan

func (hdb *HomeDB) DecrementFromInventoryByEan(ean string) (string, int, error)

checks if for the given ean a product exists in the inventory, if so decrements the amount if the amount reaches zero, the inventory entry is removed returns the products category name or the name if no category was set

func (*HomeDB) DeleteProductCategory

func (hdb *HomeDB) DeleteProductCategory(categoryId int) error

func (*HomeDB) GetCreateProductCategory

func (hdb *HomeDB) GetCreateProductCategory(tx *sql.Tx, category string) (int, error)

func (*HomeDB) GetInventory

func (hdb *HomeDB) GetInventory() ([]inventory.Entry, error)

func (*HomeDB) GetLocations

func (hdb *HomeDB) GetLocations() ([]inventory.Location, error)

func (*HomeDB) GetProductCategories

func (hdb *HomeDB) GetProductCategories() ([]product.Category, error)

func (*HomeDB) GetProducts

func (hdb *HomeDB) GetProducts() ([]product.Product, error)

func (*HomeDB) RemoveFromInventory

func (hdb *HomeDB) RemoveFromInventory(productId int, locationId int) error

func (*HomeDB) RemoveProduct

func (hdb *HomeDB) RemoveProduct(productId int) error

func (*HomeDB) ResolveProduct

func (hdb *HomeDB) ResolveProduct(ean string) (*product.Product, error)

tries to resolve product from the database by the products EAN

func (*HomeDB) UpdateInventoryEntry

func (hdb *HomeDB) UpdateInventoryEntry(productId int, locationId int, newAmount *int, newLocationId *int) error

func (*HomeDB) UpdateProduct

func (hdb *HomeDB) UpdateProduct(productId int, productName *string, productDescription *string, categoryId *int) error

func (*HomeDB) UpdateProductCategory

func (hdb *HomeDB) UpdateProductCategory(categoryId int, categoryName string) error

Jump to

Keyboard shortcuts

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