sqlc

package
v0.0.0-...-6796344 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 5 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      `json:"name"`
	Description pgtype.Text `json:"description"`
	Category    pgtype.Text `json:"category"`
	Price       int64       `json:"price"`
	Status      pgtype.Text `json:"status"`
	Tags        []string    `json:"tags"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Product

type Product struct {
	ID          uuid.UUID          `json:"id"`
	Name        string             `json:"name"`
	Description pgtype.Text        `json:"description"`
	Category    pgtype.Text        `json:"category"`
	Price       int64              `json:"price"`
	Status      pgtype.Text        `json:"status"`
	Tags        []string           `json:"tags"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
	DeletedAt   pgtype.Timestamptz `json:"deleted_at"`
}

type ProductStock

type ProductStock struct {
	ID         int32              `json:"id"`
	ProductID  uuid.UUID          `json:"product_id"`
	Location   pgtype.Text        `json:"location"`
	SoldAt     pgtype.Timestamptz `json:"sold_at"`
	ExpiryDate pgtype.Date        `json:"expiry_date"`
	CreatedAt  pgtype.Timestamptz `json:"created_at"`
}

type Querier

type Querier interface {
	CreateProduct(ctx context.Context, arg CreateProductParams) (Product, error)
}

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) WithTx

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

Jump to

Keyboard shortcuts

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