| .. | ||
| driver | ||
| embed | ||
| internal | ||
| util/osutil | ||
| vfs | ||
| .gitignore | ||
| backup.go | ||
| blob.go | ||
| config.go | ||
| conn.go | ||
| const.go | ||
| context.go | ||
| error.go | ||
| func.go | ||
| go.work | ||
| go.work.sum | ||
| json.go | ||
| LICENSE | ||
| pointer.go | ||
| quote.go | ||
| README.md | ||
| sqlite.go | ||
| stmt.go | ||
| time.go | ||
| txn.go | ||
| value.go | ||
| vtab.go | ||
Go bindings to SQLite using Wazero
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 wazero as the runtime.
Go, wazero and x/sys are the only runtime dependencies 1.
Packages
github.com/ncruces/go-sqlite3wraps the C SQLite API (example usage).github.com/ncruces/go-sqlite3/driverprovides adatabase/sqldriver (example usage).github.com/ncruces/go-sqlite3/embedembeds a build of SQLite into your application.github.com/ncruces/go-sqlite3/vfswraps the C SQLite VFS API and provides a pure Go implementation.github.com/ncruces/go-sqlite3/gormliteprovides a GORM driver.
Extensions
github.com/ncruces/go-sqlite3/ext/arrayprovides thearraytable-valued function.github.com/ncruces/go-sqlite3/ext/blobiosimplifies incremental BLOB I/O.github.com/ncruces/go-sqlite3/ext/csvreads comma-separated values.github.com/ncruces/go-sqlite3/ext/fileioreads, writes and lists files.github.com/ncruces/go-sqlite3/ext/hashprovides cryptographic hash functions.github.com/ncruces/go-sqlite3/ext/linesreads data line-by-line.github.com/ncruces/go-sqlite3/ext/pivotcreates pivot tables.github.com/ncruces/go-sqlite3/ext/statementcreates parameterized views.github.com/ncruces/go-sqlite3/ext/statsprovides statistics functions.github.com/ncruces/go-sqlite3/ext/unicodeprovides Unicode aware functions.github.com/ncruces/go-sqlite3/ext/zordermaps multidimensional data to one dimension.github.com/ncruces/go-sqlite3/vfs/memdbimplements an in-memory VFS.github.com/ncruces/go-sqlite3/vfs/readervfsimplements a VFS for immutable databases.github.com/ncruces/go-sqlite3/vfs/adiantumwraps a VFS to offer encryption at rest.
Advanced features
- incremental BLOB I/O
- nested transactions
- custom functions
- virtual tables
- custom VFSes
- online backup
- JSON support
- math functions
- full-text search
- geospatial search
- encryption at rest
- and more…
Caveats
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.
Testing
This project aims for high test coverage. It also benefits greatly from SQLite's and wazero's thorough testing.
Every commit is tested on Linux (amd64/arm64/386/riscv64/s390x), macOS (amd64/arm64), Windows (amd64), FreeBSD (amd64), illumos (amd64), and Solaris (amd64).
The Go VFS is tested by running SQLite's mptest.
Performance
Perfomance of the database/sql driver is
competitive with alternatives.
The Wasm and VFS layers are also tested by running SQLite's speedtest1.
Alternatives
-
anything else you find in
go.modis either a test dependency, or needed by one of the extensions. ↩︎