Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OrderLineMeta = drel.ModelMeta[OrderLine]{ Table: "order_lines", Columns: []string{"order_id", "line_no", "qty", "created_at", "updated_at"}, PKColumns: []string{"order_id", "line_no"}, Scan: scanOrderline, Snapshot: snapshotOrderline, Diff: diffOrderline, PKValue: orderlinePKValue, KeyValues: orderlineKeyValues, InsertColumns: orderlineInsertColumns, ScanReturning: orderlineScanReturning, ColumnValue: orderlineColumnValue, NormalizeKey: orderlineNormalizeKey, KeyStrategy: drel.KeyAppAssigned, SetKey: func(p *OrderLine, key any) { p.SetID(key.(OrderLineKey)) }, KeyIsZero: orderlineKeyIsZero, ScanGenerated: orderlineScanGenerated, }
View Source
var OrderLines = struct { OrderID drel.OrderedColumn[int] LineNo drel.OrderedColumn[int] Qty drel.OrderedColumn[int] CreatedAt drel.TimeColumn UpdatedAt drel.TimeColumn }{ OrderID: drel.NewOrderedCol[int]("order_id"), LineNo: drel.NewOrderedCol[int]("line_no"), Qty: drel.NewOrderedCol[int]("qty"), CreatedAt: drel.NewTimeCol("created_at"), UpdatedAt: drel.NewTimeCol("updated_at"), }
Functions ¶
This section is empty.
Types ¶
type OrderLine ¶
type OrderLine struct {
drel.Model[OrderLineKey]
Qty int `db:"qty"`
}
OrderLine is keyed by OrderLineKey. A composite key is always application-assigned: set it with SetID before Add.
func NewOrderLine ¶
func NewOrderLine(key OrderLineKey, qty int) *OrderLine
type OrderLineKey ¶
OrderLineKey is a two-column composite primary key. Each exported field becomes one key column, named by its own db tag; field order is the key order.
type OrderLineRepository ¶
type OrderLineRepository struct {
*drel.Repository[OrderLine]
}
func (*OrderLineRepository) FindByID ¶
func (r *OrderLineRepository) FindByID(ctx context.Context, id OrderLineKey) (*OrderLine, error)
type TxOrderLineRepository ¶
type TxOrderLineRepository struct {
*drel.TxRepository[OrderLine]
}
func (*TxOrderLineRepository) FindByID ¶
func (r *TxOrderLineRepository) FindByID(ctx context.Context, id OrderLineKey) (*OrderLine, error)
Click to show internal directories.
Click to hide internal directories.