products

package
v0.0.0-...-cecfe9f Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateProductParams

type CreateProductParams struct {
	Name      string
	Price     string
	Available sql.NullBool
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Product

type Product struct {
	ID        int32
	Name      string
	Price     string
	Available sql.NullBool
	Created   sql.NullTime
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateProduct

func (q *Queries) CreateProduct(ctx context.Context, arg CreateProductParams) (Product, error)

func (*Queries) DeleteProduct

func (q *Queries) DeleteProduct(ctx context.Context, id int32) error

func (*Queries) GetProduct

func (q *Queries) GetProduct(ctx context.Context, id int32) (Product, error)

func (*Queries) ListProducts

func (q *Queries) ListProducts(ctx context.Context) ([]Product, error)

func (*Queries) TotalPrice

func (q *Queries) TotalPrice(ctx context.Context) (float64, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

Jump to

Keyboard shortcuts

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