Abstracts SQL operations across PostgreSQL, CockroachDB, and SQLite through unified interfaces. Reuses for database-agnostic query execution and transaction management in multi-backend systems.
// Source: https://github.com/dbos-inc/dbos-transact-golang | License: MIT | Copyright 2024 DBOS, Inc // Provided via justclaw.it.com; keep this notice with the code. package sysdb import ( "context" "database/sql" "errors" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" ) // dbq.go: a thin driver-agnostic SQL surface used by sysDB. // // Each backend type can implement the same interfaces: // pgxPoolAdapter → wraps *pgxpool.Pool / pgx.Tx (Postgres + CockroachDB) // sqlPoolAdapter → wraps *sql.DB / *sql.Tx (SQLite via modernc.org/sqlite) // // Higher-level code (sysDB methods, the migration runner, runAsTxn in // workflow.go) talks to these interfaces, so it does not have to know which // driver is in use. Per-dialect query fragments (placeholder style, schema ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key