Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Go bindings to SQLite using Wazero
Go module github.com/ncruces/go-sqlite3 wraps a WASM build of SQLite,
and uses wazero to provide cgo-free SQLite bindings.
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.
Loadable extensions
github.com/ncruces/go-sqlite3/ext/arrayprovides thearraytable-valued function.github.com/ncruces/go-sqlite3/ext/blobsimplifies incremental BLOB I/O.github.com/ncruces/go-sqlite3/ext/csvreads comma-separated values.github.com/ncruces/go-sqlite3/ext/linesreads files line-by-line.github.com/ncruces/go-sqlite3/ext/pivotcreates pivot tables.github.com/ncruces/go-sqlite3/ext/statementcreates table-valued functions with SQL.github.com/ncruces/go-sqlite3/ext/statsprovides statistics functions.github.com/ncruces/go-sqlite3/ext/unicodeprovides Unicode aware functions.github.com/ncruces/go-sqlite3/vfs/memdbimplements an in-memory VFS.github.com/ncruces/go-sqlite3/vfs/readervfsimplements a VFS for immutable databases.
Advanced features
- incremental BLOB I/O
- nested transactions
- custom functions
- virtual tables
- custom VFSes
- online backup
- JSON support
- Unicode support
Caveats
This module replaces the SQLite OS Interface (aka VFS) with a pure Go implementation. This has benefits, but also comes with some drawbacks.
Write-Ahead Logging
Because WASM does not support shared memory, WAL support is limited.
To work around this limitation, SQLite is patched
to always use EXCLUSIVE locking mode for WAL databases.
Because connection pooling is incompatible with EXCLUSIVE locking mode,
to use the database/sql driver
with WAL mode databases you should disable connection pooling by calling
db.SetMaxOpenConns(1).
File Locking
POSIX advisory locks, which SQLite uses on Unix, are broken by design.
On Linux, macOS and illumos, this module uses OFD locks to synchronize access to database files. OFD locks are fully compatible with POSIX advisory locks.
On BSD Unixes, this module uses BSD locks. On BSD Unixes, BSD locks are fully compatible with POSIX advisory locks.
On Windows, this module uses LockFile, LockFileEx, and UnlockFile,
like SQLite.
On all other platforms, file locking is not supported, and you must use
nolock=1
to open database files.
To use the database/sql driver
with nolock=1 you must disable connection pooling by calling
db.SetMaxOpenConns(1).
Testing
The pure Go VFS is tested by running SQLite's mptest on Linux, macOS, Windows and FreeBSD. Performance is tested by running speedtest1.