Files
dbx/doc.go
T
end 81e724f72b feat(graphql): add JS-safe uint64 marshal helpers
Adds MarshalUint64, UnmarshalUint64, and Uint64Marshaler for gqlgen-
compatible uint64 string scalars without a gqlgen dependency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 18:26:43 -07:00

58 lines
2.3 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. [CurrentDialect] reports the configured dialect.
// Only one database per process is supported.
//
// # Query and mutation helpers
//
// [Fetch], [FetchOne], [Query], [Insert], [Update], [Delete], and their Must*
// and Context variants wrap Jet [Statement] execution with consistent error
// semantics. [UpdateOne] requires at least one row affected.
// [WithTx] and [WithTxValue] run functions inside SQL transactions.
//
// # Jet column utilities
//
// Dialect-neutral type aliases ([Column], [ColumnList]) and helpers for column
// lists ([NormalCols], [ContainsCol]) and expression building ([ExprValues]).
// [QueryCount] and [BuildQueryCountFn] support pagination total counts.
//
// 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. Both implement [ApplyInterface] via Equal and IsZero for use
// with [ApplyInterfacePtr]. Both share identical GraphQL string scalar transit.
// Choose StringKSUID for text columns (VARCHAR, TEXT); choose BinaryKSUID for
// binary columns (BINARY(20), BYTEA). [ParseStringKSUIDAny] and
// [ParseBinaryKSUIDAny] accept flexible input for API boundaries.
//
// [JSONB] provides map-based JSON column scanning for Postgres JSONB and MySQL JSON.
//
// # GraphQL scalars
//
// [MarshalUint64] and [UnmarshalUint64] provide JS-safe uint64 serialization for
// gqlgen without importing gqlgen directly.
//
// # 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. Setup returns an error if DebugLog is
// enabled without the matching blank import.
//
// # Dialect notes
//
// Use [Insert] with LastInsertId on MySQL; Postgres callers should use
// [InsertReturning]. [InsertReturning] and [UpdateReturning] require Jet
// RETURNING clauses.
package dbx