Files
dbx/doc.go
T
end 8d697eda5b feat: add delete, context, and tx helpers
Add Delete/DeleteAffected, context-aware CRUD helpers, WithTx, ContainsCol,
and queryReturning deduplication for returning statements.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 17:49:57 -07:00

42 lines
1.4 KiB
Go

// Package dbx provides database utilities built on go-jet/jet and go-toolkit/app.
//
// # Module lifecycle
//
// Call [ModuleDB] once to register the database [app.Module], then use [SQLO]
// to access the connection pool. Only one database per process is supported.
//
// # Query and mutation helpers
//
// [Fetch], [FetchOne], [Insert], [Update], [Delete], and their Must* and Context
// variants wrap Jet [Statement] execution with consistent error semantics.
//
// # Jet column utilities
//
// Dialect-neutral type aliases ([Column], [ColumnList]) and helpers for column
// lists ([NormalCols], [ContainsCol]) and expression building ([ExprValues]).
//
// Partial-update helpers ([ApplyPtr], [ApplyVal]) track changed fields for
// repository patch logic.
//
// # Identifier types
//
// [StringKSUID] and [BinaryKSUID] wrap segmentio/ksuid with storage-specific
// SQL encoding. [JSONB] provides map-based JSON column scanning.
//
// # Pointer and string utilities
//
// [Ptr], [Val], [TrimPtr], [StringToFilter], and related helpers for nullable
// field handling in repository code.
//
// # Debug logging
//
// Enable [DBConfig.DebugLog] and blank-import dbxm (MySQL) or dbxp (Postgres)
// to register Jet query debug output.
//
// # Dialect notes
//
// Use [Insert] with LastInsertId on MySQL; Postgres callers should use
// [InsertReturning]. [InsertReturning] and [UpdateReturning] require Jet
// RETURNING clauses.
package dbx