Nuno Cruces d9fcf60b7d Driver API.
2023-09-20 02:41:09 +01:00
2023-09-18 15:11:05 +01:00
2023-09-20 02:41:09 +01:00
2023-09-15 15:10:08 +01:00
2023-09-02 00:48:55 +01:00
2023-09-20 02:41:09 +01:00
2023-07-11 12:30:39 +01:00
2023-09-11 23:48:38 +01:00
2023-09-20 02:41:09 +01:00
2023-09-18 15:11:05 +01:00
2023-03-05 12:20:02 +00:00
2023-07-03 17:42:53 +01:00
2023-05-25 17:03:40 +01:00
2023-09-20 02:41:09 +01:00
2023-07-04 02:29:38 +01:00
2023-07-04 02:29:38 +01:00
2023-09-20 02:41:09 +01:00
2023-06-30 12:25:07 +01:00
2023-06-30 12:25:07 +01:00
2023-03-08 17:39:41 +00:00
2023-07-13 12:19:32 +01:00
2023-09-01 01:23:25 +01:00
2023-09-01 02:38:57 +01:00
2023-09-11 23:48:38 +01:00
2023-09-11 23:48:38 +01:00
2023-08-09 16:16:45 +01:00
2023-09-18 15:22:11 +01:00
2023-01-11 14:54:42 +00:00
2023-09-18 15:11:05 +01:00
2023-07-04 02:29:38 +01:00
2023-07-11 12:30:39 +01:00
2023-02-24 15:06:19 +00:00
2023-08-10 13:18:13 +01:00
2023-03-29 15:06:22 +01:00
2023-04-21 13:33:24 +01:00
2023-07-03 17:42:53 +01: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 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).

POSIX Advisory Locks

POSIX advisory locks, which SQLite uses, 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 process-associated POSIX advisory locks.

On BSD Unixes, this module may use BSD locks. BSD locks may not be compatible with process-associated POSIX advisory locks.

TL;DR

In all platforms for which this package builds, it should be safe to use it to access databases concurrently, from multiple goroutines, processes, and with other implementations of SQLite.

If the package does not build for your platform, see this.

Testing

The pure Go VFS is tested by running SQLite's mptest on Linux, macOS and Windows. Performance is tested by running speedtest1.

Roadmap

  • advanced SQLite features
    • custom functions
    • nested transactions
    • incremental BLOB I/O
    • online backup
    • session extension
  • custom VFSes

Alternatives

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