refactor: split dbx package into domain files

Reorganize monolithic dbx.go and utility.go into focused files by
concern, add package doc.go, and gitignore coverage.out.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 17:46:54 -07:00
parent 14686a83cb
commit f9befa1b0a
16 changed files with 652 additions and 583 deletions
+42
View File
@@ -0,0 +1,42 @@
// 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], and [Update] wrap Jet [Statement] execution
// with consistent error semantics. Must* variants return a caller-provided error
// when no rows are found.
//
// # Jet column utilities
//
// Dialect-neutral union types ([Column], [ColumnList]) and helpers for column
// lists ([NormalCols]) and expression building ([ExprValues]).
//
// Partial-update helpers ([ApplyPtr], [ApplyVal]) track changed fields for
// repository patch logic.
//
// # Identifier types
//
// [UUID] wraps segmentio/ksuid for GraphQL APIs. [JSONB] provides map-based
// JSON column scanning for Postgres JSONB and MySQL JSON.
//
// # 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