products

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProductMeta = drel.ModelMeta[Product]{
	Table:         "products",
	Columns:       []string{"id", "name", "price", "category", "in_stock", "created_at", "updated_at"},
	PKColumns:     []string{"id"},
	Scan:          scanProduct,
	Snapshot:      snapshotProduct,
	Diff:          diffProduct,
	PKValue:       productPKValue,
	InsertColumns: productInsertColumns,
	ScanReturning: productScanReturning,
	ColumnValue:   productColumnValue,
	NormalizeKey:  productNormalizeKey,
}
View Source
var Products = struct {
	ID        drel.OrderedColumn[int]
	Name      drel.StringColumn
	Price     drel.OrderedColumn[int]
	Category  drel.StringColumn
	InStock   drel.BoolColumn
	CreatedAt drel.TimeColumn
	UpdatedAt drel.TimeColumn
}{
	ID:        drel.NewOrderedCol[int]("id"),
	Name:      drel.NewStringCol("name"),
	Price:     drel.NewOrderedCol[int]("price"),
	Category:  drel.NewStringCol("category"),
	InStock:   drel.NewBoolCol("in_stock"),
	CreatedAt: drel.NewTimeCol("created_at"),
	UpdatedAt: drel.NewTimeCol("updated_at"),
}

Functions

This section is empty.

Types

type Product

type Product struct {
	drel.Model[int]
	Name     string `db:"name"`
	Price    int    `db:"price"`
	Category string `db:"category"`
	InStock  bool   `db:"in_stock"`
}

type ProductRepository

type ProductRepository struct {
	*drel.Repository[Product]
}

func (*ProductRepository) FindByID

func (r *ProductRepository) FindByID(ctx context.Context, id int) (*Product, error)

type TxProductRepository

type TxProductRepository struct {
	*drel.TxRepository[Product]
}

func (*TxProductRepository) FindByID

func (r *TxProductRepository) FindByID(ctx context.Context, id int) (*Product, error)

Jump to

Keyboard shortcuts

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