2023-03-07 04:37:55 +00:00
2023-03-05 12:20:02 +00:00
2023-03-05 14:33:51 +00:00
2023-03-07 04:37:55 +00:00
2023-03-07 04:37:55 +00:00
2023-03-07 04:37:55 +00:00
2023-03-05 12:20:02 +00:00
2023-03-07 04:37:55 +00:00
2023-03-07 04:37:55 +00:00
2023-02-22 14:19:56 +00:00
2023-02-27 03:20:23 +00:00
2023-02-27 12:07:48 +00:00
2023-03-01 10:34:39 +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-07 04:37:55 +00:00
2023-02-24 15:06:19 +00:00
2023-03-01 10:34:39 +00:00
2023-02-22 14:19:56 +00:00
2023-03-01 10:34:39 +00:00
2023-03-01 23:47:24 +00:00
2023-02-23 13:29:51 +00:00
2023-03-01 13:12:32 +00:00
2023-02-23 13:29:51 +00:00
2023-02-21 12:56:39 +00:00
2023-02-23 13:29:51 +00:00
2023-02-23 13:29:51 +00:00
2023-03-05 12:20:02 +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

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, and WAL databases are not supported.

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.

Roadmap

  • build SQLite using zig cc --target=wasm32-wasi
  • :memory: databases
  • port test_demovfs.c to Go
    • branch wasi uses test_demovfs.c directly
  • design a nice API, enough for simple use cases
  • provide a simple database/sql driver
  • file locking, compatible with SQLite on macOS/Linux/Windows
  • 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%