Go bindings to SQLite using wasm2go
1,105
stars
1,161
commits
Go
primary language
Sep 11, 2026
updated
Go module github.com/ncruces/go-sqlite3 is a cgo-free SQLite wrapper.
It provides a database/sql compatible driver,
as well as direct access to most of the C SQLite API.
It wraps a Wasm build of SQLite,
and uses wasm2go to translate it to Go.
Go and x/sys are the only direct dependencies.
Using the database/sql driver:
import "database/sql"
import _ "github.com/ncruces/go-sqlite3/driver"
var version string
db, _ := sql.Open("sqlite3", "file:demo.db")
db.QueryRow(`SELECT sqlite_version()`).Scan(&version)
github.com/ncruces/go-sqlite3
wraps the C SQLite API
(example).github.com/ncruces/go-sqlite3/driver
provides a database/sql driver
(example).github.com/ncruces/go-sqlite3/vfs
wraps the C SQLite VFS API and provides a pure Go implementation.github.com/ncruces/go-sqlite3/gormlite
provides a GORM driver.This module replaces the SQLite OS Interface (aka VFS) with a pure Go implementation, which has advantages and disadvantages. Read more about the Go VFS design here.
Because each database connection executes within a Wasm sandboxed environment, memory usage will be higher than alternatives.
This project aims for high test coverage. It also benefits greatly from SQLite's thorough testing.
Every commit is tested on:
Certain operating system and CPU combinations have some limitations. See the support matrix for a complete overview.
The Go VFS is tested by running SQLite's mptest.
Performance of the database/sql driver is
competitive with alternatives.
The Wasm and VFS layers are also benchmarked by running SQLite's speedtest1.
This module behaves similarly to SQLite in multi-thread mode: it is goroutine-safe, provided that no single database connection, or object derived from it, is used concurrently by multiple goroutines.
The database/sql API is safe to use concurrently,
according to its documentation.
For questions, please see Discussions.
Also, post there if you used this driver for something interesting ("Show and tell"), have an idea…
The Issues tracker is for bugs, and features we're working on, planning to work on, or asking for help with.
Go
99.8%
Go bindings to SQLite using wasm2go
1,105
stars
1,161
commits
Go
primary language
Sep 11, 2026
updated
Go module github.com/ncruces/go-sqlite3 is a cgo-free SQLite wrapper.
It provides a database/sql compatible driver,
as well as direct access to most of the C SQLite API.
It wraps a Wasm build of SQLite,
and uses wasm2go to translate it to Go.
Go and x/sys are the only direct dependencies.
Using the database/sql driver:
import "database/sql"
import _ "github.com/ncruces/go-sqlite3/driver"
var version string
db, _ := sql.Open("sqlite3", "file:demo.db")
db.QueryRow(`SELECT sqlite_version()`).Scan(&version)
github.com/ncruces/go-sqlite3
wraps the C SQLite API
(example).github.com/ncruces/go-sqlite3/driver
provides a database/sql driver
(example).github.com/ncruces/go-sqlite3/vfs
wraps the C SQLite VFS API and provides a pure Go implementation.github.com/ncruces/go-sqlite3/gormlite
provides a GORM driver.This module replaces the SQLite OS Interface (aka VFS) with a pure Go implementation, which has advantages and disadvantages. Read more about the Go VFS design here.
Because each database connection executes within a Wasm sandboxed environment, memory usage will be higher than alternatives.
This project aims for high test coverage. It also benefits greatly from SQLite's thorough testing.
Every commit is tested on:
Certain operating system and CPU combinations have some limitations. See the support matrix for a complete overview.
The Go VFS is tested by running SQLite's mptest.
Performance of the database/sql driver is
competitive with alternatives.
The Wasm and VFS layers are also benchmarked by running SQLite's speedtest1.
This module behaves similarly to SQLite in multi-thread mode: it is goroutine-safe, provided that no single database connection, or object derived from it, is used concurrently by multiple goroutines.
The database/sql API is safe to use concurrently,
according to its documentation.
For questions, please see Discussions.
Also, post there if you used this driver for something interesting ("Show and tell"), have an idea…
The Issues tracker is for bugs, and features we're working on, planning to work on, or asking for help with.
Go
99.8%