This repository was archived by the owner on Mar 29, 2026. It is now read-only.
SQLC/database/sql support (no implementation changes)#1
Closed
Copilot wants to merge 1 commit into
Closed
Conversation
Copilot
AI
changed the title
[WIP] Add MVP support for Go database/sql and sqlc
SQLC/database/sql support (no implementation changes)
Jan 30, 2026
Owner
|
@copilot What am I reviewing? There are no files modified? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement MVP support for Go
database/sql+sqlcvia a stable C ABI, a cgo-backed driver, and a minimal sqlc configuration/example while keeping scope limited to the Baseline API and$Nparameters.No example snippet; no implementation changes were made.
Original prompt
You are a coding agent working in the DecentDB repo. Implement MVP support for Go
database/sql+sqlcas specified in SQLC_SUPPORT.md, without expanding scope to SQLAlchemy/Dapper.Read first (required):
Goal (MVP):
prepare/bind/step/column/finalize) and error reporting (last_error_code/message) matching the “Baseline API” in SQLC_SUPPORT.md.database/sql/driverimplementation (decentdb driver name) that uses cgo to call the C ABI, supports$1..$Nparameters, and passes end-to-end tests.sqlcconfig demonstratingengine: postgresqlso generated SQL uses$N.Scope constraints:
Implementation tasks (deliverables):
A) Nim C ABI
cdecl, and opaque handle types fordecentdb_db*anddecentdb_stmt*.decentdb_open(path_utf8, options_utf8) -> decentdb_db*decentdb_close(db) -> intdecentdb_last_error_code(db) -> intdecentdb_last_error_message(db) -> const char*decentdb_prepare(db, sql_utf8, out_stmt**) -> intdecentdb_bind_null/int64/float64/text/blob(stmt, index_1_based, ...) -> intdecentdb_step(stmt) -> int(1 row, 0 done, <0 error)decentdb_column_count/name/type(stmt, col_0_based) -> ...decentdb_column_is_null/int64/float64/text/blob(stmt, col_0_based, ...) -> ...decentdb_rows_affected(stmt) -> int64decentdb_finalize(stmt) -> voidconst char*orconst uint8_t*is a borrowed view valid until the next mutation of the same handle or finalize/close. Keep it safe and deterministic.B) Build output for native library
.soon Linux; keep hooks for macOS/Windows but Linux support is the immediate target).C) Go driver (
database/sql/driver)bindings/go/decentdb-go/).driver.Driver, plus context-aware interfaces:QueryContext,ExecContext,BeginTx, andPrepareContextwhere applicable.file:/absolute/path/to.db?cache_size=...&busy_timeout_ms=...&fsync=on|off(parse withnet/url). Unknown options should error (or be clearly ignored with a comment + test).$Nplaceholders; reject?and named params rather than rewriting.nil,int64/int,float64,bool,string,[]byte,time.Time(epoch-ms UTC).Rows.Nextand decode columns intodriver.Value.BeginTx/Commit/Rollbackvia SQL (BEGIN/COMMIT/ROLLBACK) or direct engine hooks if they exist; keep semantics consistent with Snapshot Isolation (don’t claim stronger).DecentDBError{Code, Message, SQL}) and map “bad connection” cases todriver.ErrBadConn.D) Tests + docs (Definition of Done)
testing+database/sqlthat:CREATE TABLE,INSERT,SELECTwith$1bindingsengine: postgresql) and a tinyqueries.sqland usage snippet.Validation commands (run locally as part of the work):
nimble test(or the repo’s existing test runner; discover and use the standard one)go test source.within the Go module folderOutput expectations:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.