database

package
v0.0.0-...-6cd2808 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbInterface

type DbInterface interface {
	OpenConnection() error
	InitSchema() error

	GetProducts() ([]*model.Product, error)
	GetProductById(uint) (*model.Product, error)
	CreateProduct(*model.Product) (*model.Product, error)
	UpdateProduct(*model.Product) (*model.Product, error)
	SoftDeleteProductById(uint) error
	DeleteProductById(uint) error
}

func NewDbInterface

func NewDbInterface() (DbInterface, error)

type DbInterfaceImpl

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

func (*DbInterfaceImpl) CreateProduct

func (d *DbInterfaceImpl) CreateProduct(product *model.Product) (*model.Product, error)

func (*DbInterfaceImpl) DeleteProductById

func (d *DbInterfaceImpl) DeleteProductById(productId uint) error

func (*DbInterfaceImpl) GetProductById

func (d *DbInterfaceImpl) GetProductById(productId uint) (*model.Product, error)

func (*DbInterfaceImpl) GetProducts

func (d *DbInterfaceImpl) GetProducts() ([]*model.Product, error)

func (*DbInterfaceImpl) InitSchema

func (d *DbInterfaceImpl) InitSchema() error

func (*DbInterfaceImpl) OpenConnection

func (d *DbInterfaceImpl) OpenConnection() error

func (*DbInterfaceImpl) SoftDeleteProductById

func (d *DbInterfaceImpl) SoftDeleteProductById(productId uint) error

func (*DbInterfaceImpl) UpdateProduct

func (d *DbInterfaceImpl) UpdateProduct(updatedProduct *model.Product) (*model.Product, error)

UpdateProduct uses non-zero fields struct to update the product. The input product must have the ID, otherwise it's not possible to update it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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