database

package
v0.0.0-...-16b6e5b Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProduct

func CreateProduct(db *sql.DB, product *Product, ctx context.Context) error

func DeleteProduct

func DeleteProduct(db *sql.DB, productId int, ctx context.Context) error

func GetProduct

func GetProduct(db *sql.DB, product *Product, ctx context.Context) error

func InitDb

func InitDb(db *sql.DB) error

func New

func New() (*sql.DB, error)

func NewWithWrappedTracing

func NewWithWrappedTracing() (*sql.DB, error)

func PingDb

func PingDb(db *sql.DB, maxRetry uint64) error

func UpdateProduct

func UpdateProduct(db *sql.DB, product *Product, ctx context.Context) error

Types

type Product

type Product struct {
	ID    int     `json:"id"`
	Name  string  `json:"name"`
	Price float64 `json:"price"`
}

func GetProducts

func GetProducts(db *sql.DB, start, count int, ctx context.Context) ([]*Product, error)

func (*Product) String

func (p *Product) String() string

Jump to

Keyboard shortcuts

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