Documentation ¶
Index ¶
- type DbInterface
- type DbInterfaceImpl
- func (d *DbInterfaceImpl) CreateProduct(product *model.Product) (*model.Product, error)
- func (d *DbInterfaceImpl) DeleteProductById(productId uint) error
- func (d *DbInterfaceImpl) GetProductById(productId uint) (*model.Product, error)
- func (d *DbInterfaceImpl) GetProducts() ([]*model.Product, error)
- func (d *DbInterfaceImpl) InitSchema() error
- func (d *DbInterfaceImpl) OpenConnection() error
- func (d *DbInterfaceImpl) SoftDeleteProductById(productId uint) error
- func (d *DbInterfaceImpl) UpdateProduct(updatedProduct *model.Product) (*model.Product, error)
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 (*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 ¶
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.
Click to show internal directories.
Click to hide internal directories.