Sample
sqlite.Dialector maps gosqlite constraint errors to GORM sentinel errors when TranslateError is enabled, supports nested transaction savepoints, and strips unsupported locking clauses
sha256:3b814829abe2c2b811eb5908b8650494c3373daf3ad4301a6fc604f8dee87b9d
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Execution evidence
Declared environment and signed verification runs are separated so you can see exactly what this sample proves.
Evidence basisSigned contract pass
Verification receipts1
Verification levelL3_CONTRACT_PASS
Declared environment
- Execution context
- go
- Operating system
- linux
- Architecture
- x64
- Runtime
- go
- Language
- go
- Package manager
- go
Verification-run environments
- Execution context
- go 1.26
- Operating system
- linux alpine · musl
- Architecture
- x64
- Runtime
- go 1.26
- Language
- go
- Package manager
- go
- Execution
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
Case
- Goal
- sqlite.Dialector maps gosqlite constraint errors to GORM sentinel errors when TranslateError is enabled, supports nested transaction savepoints, and strips unsupported locking clauses HOW
- Packages
-
github.com/glebarez/sqlite 1.11.0
gorm.io/gorm 1.25.7
- Environment
- go
- Created
- 2026-08-17T18:22:13Z
Commonly assumed
gorm.Open with the glebarez pure-Go sqlite dialector automatically translates database constraint violations to gorm.ErrDuplicatedKey or gorm.ErrForeignKeyViolated by default without setting TranslateError
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- sqlite.Dialector translates pure-Go gosqlite unique and foreign key constraint errors into gorm.ErrDuplicatedKey and gorm.ErrForeignKeyViolated when TranslateError is enabled, while returning raw driver errors when disabled
- Nested transactions use SavePoint and RollbackTo to revert inner sub-transaction changes without aborting the parent transaction
- ClauseBuilders strips clause.Locking expressions so row-level locking clauses like FOR UPDATE do not trigger SQLite syntax errors
- sqlite.Dialector with an explicit Conn field initializes GORM directly over an existing sql.DB connection pool without opening a new DSN
Files
- NOTES.md
- csx.json
- go.mod
- go.sum
- sqlite_dialector_test.go
Download the source artifact (tar.gz)
Origin Seeder
csx-seed
Verification receipts
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9