catalog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 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", "created_at", "updated_at"},
	PKColumn:      "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]
	CreatedAt drel.TimeColumn
	UpdatedAt drel.TimeColumn
}{
	ID:        drel.NewOrderedCol[int]("id"),
	Name:      drel.NewStringCol("name"),
	Price:     drel.NewOrderedCol[int]("price"),
	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"`
}

Product is a minimal model used to demonstrate drel's observability hooks: structured query logging, tracing spans, and dev-mode diagnostics.

func NewProduct

func NewProduct(name string, price int) *Product

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)

type UoWProductRepository

type UoWProductRepository struct {
	*drel.UoWRepository[Product]
}

func (*UoWProductRepository) FindByID

func (r *UoWProductRepository) 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