Package: gorm-sqlite
A CGO-free SQLite dialector for GORM, built on top of modernc.org/sqlite.
No C toolchain is required, making it suitable for cross-compilation and minimal
container images.
Repository: https://github.com/dracory/gorm-sqlite
Installation
go get github.com/dracory/gorm-sqlite
Usage
package main
import (
"gorm.io/gorm"
gormsqlite "github.com/dracory/gorm-sqlite"
_ "modernc.org/sqlite" // register the SQLite driver
)
func main() {
db, err := gorm.Open(gormsqlite.Open("app.db"), &gorm.Config{})
if err != nil {
panic(err)
}
_ = db
}
Features
- Full GORM migration support —
AutoMigrate, schema and index operations. - SQLite ≥ 3.35
RETURNINGclause detected at runtime. - Connection pool pre-configured for SQLite's single-writer model.
- DSN validation rejects path traversal and absolute paths by default.
Explainredacts sensitive parameter values before logging.