persistence

package
v0.0.0-...-0519aef Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INSERT   = "INSERT INTO products (product_id, name, price) VALUES ($1, $2, $3)"
	UPDATE   = "UPDATE products SET name = $1, price = $2 WHERE product_id = $3"
	DELETE   = "DELETE FROM products WHERE product_id = $1"
	FIND_ID  = "SELECT * FROM products WHERE product_id = $1"
	LIST_ALL = "SELECT * FROM products"
)

Variables

This section is empty.

Functions

func NewProductRepository

func NewProductRepository(db *sqlx.DB) business.ProductRepository

Types

type ProductRepositoryImpl

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

func (ProductRepositoryImpl) Delete

func (p ProductRepositoryImpl) Delete(value string) error

func (ProductRepositoryImpl) FindById

func (p ProductRepositoryImpl) FindById(value string) (models.Product, error)

func (ProductRepositoryImpl) ListAllProducts

func (p ProductRepositoryImpl) ListAllProducts() []models.Product

func (ProductRepositoryImpl) Save

func (p ProductRepositoryImpl) Save(product models.Product) error

func (ProductRepositoryImpl) Update

func (p ProductRepositoryImpl) Update(product models.Product) error

Jump to

Keyboard shortcuts

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