Nuno Cruces 88cf845651 JSON stats.
2024-01-25 11:03:33 +00:00
2024-01-23 17:50:11 +00:00
2024-01-22 11:21:30 +00:00
2024-01-25 11:03:33 +00:00
2024-01-17 16:36:26 +00:00
2024-01-11 02:18:12 +00:00
2024-01-22 11:21:30 +00:00
2024-01-22 11:21:30 +00:00
2024-01-03 12:54:26 +00:00
2024-01-24 09:58:05 +00:00
2023-03-05 12:20:02 +00:00
2024-01-18 15:53:00 +00:00
2023-12-02 12:17:18 +00:00
2024-01-18 15:53:00 +00:00
2024-01-18 15:53:00 +00:00
2024-01-18 15:53:00 +00:00
2024-01-18 15:53:00 +00:00
2023-12-02 12:17:18 +00:00
2024-01-11 02:18:12 +00:00
2023-03-08 17:39:41 +00:00
2023-11-27 15:37:53 +00:00
2023-09-01 01:23:25 +01:00
2024-01-11 02:18:12 +00:00
2023-08-09 16:16:45 +01:00
2023-12-29 23:42:30 +00:00
2023-12-29 23:42:37 +00:00
2023-01-11 14:54:42 +00:00
2023-12-29 23:42:37 +00:00
2023-11-04 01:18:25 +00:00
2024-01-24 09:58:05 +00:00
2023-12-02 12:17:18 +00:00
2024-01-15 10:43:36 +00:00
2024-01-18 15:53:00 +00:00
2024-01-03 12:43:03 +00:00
2024-01-18 15:11:04 +00:00
2024-01-18 15:53:00 +00:00
2024-01-08 19:23:56 +00:00
2024-01-18 15:53:00 +00:00

Go bindings to SQLite using Wazero

Go Reference Go Report Go Coverage

Go module github.com/ncruces/go-sqlite3 is 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.

Packages

Extensions

Advanced features

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 LockFileEx and UnlockFileEx, like SQLite.

On all other platforms, file locking is not supported, and you must use nolock=1 (or immutable=1) to open database files.

To use the database/sql driver with nolock=1 you must disable connection pooling by calling db.SetMaxOpenConns(1).

You can use vfs.SupportsFileLocking to check if your platform supports file locking.

Testing

This project aims for high test coverage. It also benefits greatly from SQLite's and wazero's thorough testing.

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

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

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