2023-03-16 12:27:44 +00:00
2023-03-05 12:20:02 +00:00
2023-03-16 12:27:44 +00:00
2023-03-15 13:29:09 +00:00
2023-03-15 13:29:09 +00:00
2023-03-16 12:27:44 +00:00
2023-03-05 12:20:02 +00:00
2023-03-16 12:27:44 +00:00
2023-03-08 17:39:41 +00:00
2023-03-16 12:27:44 +00:00
2023-03-16 12:27:44 +00:00
2023-03-08 17:39:23 +00:00
2023-03-08 13:29:33 +00:00
2023-03-08 17:39:41 +00:00
2023-03-08 17:39:41 +00:00
2023-01-11 14:54:42 +00:00
2023-02-27 03:20:23 +00:00
2023-02-27 03:20:23 +00:00
2023-03-10 16:42:20 +00:00
2023-03-10 16:42:20 +00:00
2023-02-24 15:06:19 +00:00
2023-03-07 12:15:29 +00:00
2023-03-09 14:42:29 +00:00
2023-03-08 17:39:23 +00:00
2023-03-07 14:19:22 +00:00
2023-03-07 10:47:55 +00:00
2023-03-16 02:52:22 +00:00
2023-03-10 14:17:02 +00:00
2023-03-15 13:58:16 +00:00
2023-03-16 02:52:22 +00:00
2023-03-16 12:27:44 +00:00

Go bindings to SQLite using Wazero

Go Reference Go Report Go Coverage

Go module github.com/ncruces/go-sqlite3 wraps a WASM build of SQLite, and uses wazero to provide cgo-free SQLite bindings.

Caveats

This module replaces the SQLite OS Interface (aka VFS) with a pure Go implementation. This has numerous benefits, but also comes with some caveats.

Write-Ahead Logging

Because WASM does not support shared memory, WAL support is limited.

To work around this limitation, SQLite is compiled with SQLITE_DEFAULT_LOCKING_MODE=1, making EXCLUSIVE the default locking mode. For non-WAL databases, NORMAL locking mode can be activated with PRAGMA locking_mode=NORMAL.

Because connection pooling is incompatible with EXCLUSIVE locking mode, the database/sql driver defaults to NORMAL locking mode. To open WAL databases, or use EXCLUSIVE locking mode, disable connection pooling by calling db.SetMaxOpenConns(1).

Open File Description Locks

On Unix, this module uses OFD locks to synchronize access to database files.

POSIX advisory locks, which SQLite uses, are broken by design. OFD locks are fully compatible with process-associated POSIX advisory locks, and are supported on Linux, macOS and illumos. As a work around for other Unixes, you can use nolock=1.

Testing

The pure Go VFS is stress tested by running an unmodified build of SQLite's mptest on Linux, macOS and Windows.

Roadmap

  • advanced SQLite features
    • nested transactions
    • incremental BLOB I/O
    • online backup
    • snapshots
    • session extension
    • resumable bulk update
    • shared-cache mode
    • unlock-notify
  • custom SQL functions
  • custom VFSes

Alternatives

Description
No description provided
Readme MIT 49 MiB
Languages
Go 89.9%
C 5.2%
WebAssembly 3.5%
Shell 1.4%