ncruces/go-sqlite3
View on GitHub ↗ ★ 1,132 Go
Go bindings to SQLite using wasm2go
84 mentions on Hacker News by 11 people: 6 stories, 78 comments · first 2023-04-08 · latest 2026-10-21
20082026
-
Ongoing draft: https://github.com/ncruces/go-sqlite3/pull/438
comment by ncruces · 2026-10-21 · in Two-Stack Sliding-Window Aggregation -
…SQLite, and are worried about C in a web server and RCEs, may I interest you in my SQLite driver? https://github.com/ncruces/go-sqlite3 I just wrote up the security goals of the tool I use to translate C to Go:…
comment by ncruces · 2026-10-12 · in A Modern Web App in C -
…handles instant forking (snapshots). Here's an in-memory one I made (pretty useful for unit tests): https://github.com/ncruces/go-sqlite3/tree/main/vfs/mvcc The problem DoltLite solves is merging, not forking.
comment by ncruces · 2026-09-01 · in DoltLite: A SQLite fork with Git-style version control, built with 2k agent PRs -
Agreed. I went the route of building on top of something else. Sill lots of fun. https://github.com/ncruces/go-sqlite3 And I'm still having fun. https://github.com/ncruces/go-sqlite3/pull/421
comment by ncruces · 2026-08-29 · in TurboKV: Insanely fast Rust key-value store -
…I can use either API to trigger bool and time handling in my Go driver. https://github.com/ncruces/go-sqlite3/blob/main/driver/drive...
comment by ncruces · 2026-07-12 · in Prefer strict tables in SQLite -
…access/corrupt Go memory, or other SQLite connections). And it should run everywhere Go runs. 1: https://github.com/ncruces/go-sqlite3 2: https://github.com/ncruces/wasm2go
comment by ncruces · 2026-06-07 · in A CGo-free port of SQLite/SQLite3 -
And here it is: https://github.com/ncruces/go-sqlite3/pull/375
comment by ncruces · 2026-04-14 · in Ask HN: What Are You Working On? (April 2026) -
I've been following what you've done on wasm2go ever since you moved https://github.com/ncruces/go-sqlite3 off wazero and onto wasm2go. Absolutely brilliant work! Crazy, but brilliant. Hope to contribute some time soon!
comment by unsheriff · 2026-04-13 · in Ask HN: What Are You Working On? (April 2026) -
GitHub CI lets me test my package, for free, in all these: https://github.com/ncruces/go-sqlite3/wiki/Support-matrix Which is actually useful.
comment by ncruces · 2026-03-26 · in Moving from GitHub to Codeberg, for lazy people -
…confident enough this will work that I'll be switching my mildly popular SQLite bindings to use it: https://github.com/ncruces/go-sqlite3/discussions/361 If you're interested in generated sample code, see:…
comment by ncruces · 2026-03-06 · in Ncruces/wasm2go: A WASM to Go translator -
…it available as Go APIs you can implement (including, in read-only mode, with any io.ReaderAt). https://github.com/ncruces/go-sqlite3/blob/main/vfs/readervf...
comment by ncruces · 2026-03-04 · in Show HN: Go-duckfs – making DuckDB quack like a Gopher -
…require CGO (disclosure, I made the second one): https://pkg.go.dev/modernc.org/sqlite https://pkg.go.dev/github.com/ncruces/go-sqlite3
comment by ncruces · 2026-01-23 · in Turso is an in-process SQL database, compatible with SQLite -
…locks are insane enough that when I reimplemented the SQLite file system API, I gave up on them: https://github.com/ncruces/go-sqlite3/tree/main/vfs#file-loc...
comment by ncruces · 2026-01-16 · in Everything you never wanted to know about file locking (2010) -
…you can embed SQLite in Go without cgo by using WASM builds of SQLite. In particular, this package: https://github.com/ncruces/go-sqlite3 Note: the risk here is that it's unclear how well-tested SQLite WASM builds are compared to native…
comment by koito17 · 2026-01-09 · in What happened to WebAssembly -
…not analyzed here (Gonnet & Baeza-Yates) and it's amazing how compact Shell sort can be. C: https://github.com/ncruces/go-sqlite3/blob/main/sqlite3/libc... Go: https://github.com/ncruces/sort/blob/main/shell/shell.go
comment by ncruces · 2026-01-04 · in Sorting with Fibonacci Numbers and a Knuth Reward Check -
A read-only VFS doing this can be really simple, with the right API… This is my VFS: https://github.com/ncruces/go-sqlite3/blob/main/vfs/readervf... And using it with range requests: https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/read…
comment by ncruces · 2025-12-30 · in Show HN: 22 GB of Hacker News in SQLite -
I also have this implemented and ready to go in my Go SQLite driver: https://github.com/ncruces/go-sqlite3/blob/main/litestream/e... Slightly different API (programmatic, no env variables, works with as many databases as you may want), but…
comment by ncruces · 2025-12-11 · in Litestream VFS -
…popular OS/platforms it's fine. See this for an overall picture (these are the platforms I test): https://github.com/ncruces/go-sqlite3/wiki/Support-matrix I bet you could do the similar with pglite, but this (and helping out with wazero)…
comment by ncruces · 2025-12-09 · in Epsilon: A WASM virtual machine written in Go -
I knew I remember your name working with something of sqlite and golang https://github.com/ncruces/go-sqlite3 Man I really enjoy golang and cross portability and wazero + sqlite could still be cross portable which is super fascinating What…
comment by Imustaskforhelp · 2025-12-09 · in Epsilon: A WASM virtual machine written in Go -
…I run this test matrix for less than $100/mo unbilled (where half the “cost” is from macOS alone): https://github.com/ncruces/go-sqlite3/wiki/Support-matrix I built a similar matrix to test wazero (of which I'm a maintainer).
comment by ncruces · 2025-11-27 · in Migrating the main Zig repository from GitHub to Codeberg -
…without cgo. There's also the Go-wrapped WASM build of the C sqlite[0] which is handy. [0] https://github.com/ncruces/go-sqlite3
comment by zimpenfish · 2025-10-15 · in Why Is SQLite Coded In C -
…Go, you could use my driver, and point it to a database file stored in S3 using this: https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/readerv... For read-write it's a terrible idea. Object storage assumes objects are immutable. There…
comment by ncruces · 2025-10-14 · in Beyond the SQLite single-writer limitation with concurrent writes -
…But the concept is really cool, and it's workable. I already have a version that mostly works. https://github.com/ncruces/go-sqlite3/tree/litestream/litest... With Litestream v0.5.0 doing the replication, you'll get some transient read…
comment by ncruces · 2025-10-14 · in Hold Off on Litestream 0.5.0 -
…Litestream v0.5.0 setup running. https://fly.io/blog/litestream-revamped/#lightweight-read-re... https://github.com/ncruces/go-sqlite3/tree/litestream/litest...
comment by ncruces · 2025-10-13 · in Ask HN: What are you working on? (October 2025) -
…in the vast majority of cases, but the performance may disappoint. The original still needs work. https://github.com/ncruces/go-sqlite3/tree/litestream
comment by ncruces · 2025-10-06 · in Litestream v0.5.0 -
…least feasible to get it into a working shape. https://github.com/benbjohnson/litestream/issues/772 https://github.com/ncruces/go-sqlite3/compare/main...litestr...
comment by ncruces · 2025-10-03 · in Litestream v0.5.0 -
…or is it rewritten in Go? With SQLite, although all approaches are available, my fav is to use https://github.com/ncruces/go-sqlite3 which uses Wazero. I try to avoid CGO if I can because it adds compile-time complexity, making it…
comment by OutOfHere · 2025-09-22 · in What if we treated Postgres like SQLite? -
…VFS is relatively straightforward. Here's an in-memory experiment if a few hundred lines of Go: https://github.com/ncruces/go-sqlite3/blob/v0.29.0/vfs/mvcc/... I haven't settled on what's a good storage layer for something like this.
comment by ncruces · 2025-09-11 · in Rails on SQLite: new ways to cause outages -
…possibility is doing it when a connection is closed. My driver makes adding a close callback easy. https://github.com/ncruces/go-sqlite3
comment by ncruces · 2025-08-25 · in Go and SQLite Best Practices -
…modernc you gave the correct link. For the wazero based driver, it's this package (I'm the author): https://github.com/ncruces/go-sqlite3
comment by ncruces · 2025-07-03 · in Poor Man's Back End-as-a-Service (BaaS), Similar to Firebase/Supabase/Pocketbase -
Try https://github.com/ncruces/go-sqlite3 it runs sqlite in WASM with wazero, a pure Go WASM runtime, so it builds without any CGo required. Most of the benchmarks are within a few % of the performance of mattn/go-sqlite3.
comment by infogulch · 2025-06-27 · in Why is the Rust compiler so slow? -
…optimized libc linked in a sister comment. The benchmark involves finding this line in that file: https://github.com/ncruces/go-sqlite3/blob/v0.26.1/sqlite3/l... The improvements over musl are in this table:…
comment by ncruces · 2025-06-14 · in SIMD-friendly algorithms for substring searching (2016) -
I implemented these in my attempt to SIMD optimize Wasm/WASI libc. https://github.com/ncruces/go-sqlite3/tree/main/sqlite3/libc For known haystack lengths, and large needles, I found it useful to augment the approach with Quick Search.…
comment by ncruces · 2025-06-14 · in SIMD-friendly algorithms for substring searching (2016) -
…running mptest thousands of times in CI over months). Leaving it here, maybe Ben's interested. https://github.com/ncruces/go-sqlite3/blob/c780ef16e277274e7...
comment by ncruces · 2025-05-21 · in Litestream: Revamped -
…of variants reasonable, or my repo blows up. Add your votes for additional features to this issue: https://github.com/ncruces/go-sqlite3/issues/126
comment by ncruces · 2025-05-01 · in A faster way to copy SQLite databases between computers -
Improving the libc that gets used when compiling C to Wasm (usually based on musl). https://github.com/ncruces/go-sqlite3/tree/main/sqlite3/libc
comment by ncruces · 2025-04-28 · in Ask HN: What are you working on? (April 2025) -
…least… https://modernc.org/sqlite which preprocesses and transpiles the amalgamation from C to Go. https://github.com/ncruces/go-sqlite3 which runs a Wasm build of SQLite through a pure Go Wasm runtime.
comment by ncruces · 2025-04-18 · in SQLite transactions and virtual tables -
Virtual tables are fully supported by my CGO free driver: https://pkg.go.dev/github.com/ncruces/go-sqlite3 You can have a look at a bunch of examples in my extensions folder: https://github.com/ncruces/go-sqlite3/tree/main/ext PS: The…
comment by ncruces · 2025-04-17 · in SQLite transactions and virtual tables -
…really show up in benchmarks of SQLite. I'm guessing it's mostly memset and memcpy that matter. https://github.com/ncruces/go-sqlite3/issues/257#issuecommen...
comment by ncruces · 2025-04-05 · in Building Statically Linked Go Executables with CGO and Zig -
…through a protected, private, anonymous mapping, then grow it as needed, hoping that's “free”: https://github.com/ncruces/go-sqlite3/blob/v0.25.0/internal/... The default was to reserve 4GB per connection, because each Wasm sandbox can…
comment by ncruces · 2025-04-05 · in Growing Buffers to Avoid Copying Data -
…and something that implements a io.ReaderAt with http Range requests (possibly with some caching). https://github.com/ncruces/go-sqlite3/blob/main/vfs/readervf... This is compatible with S3, but also GCS, and really any thing that supports…
comment by ncruces · 2025-02-08 · in Show HN: SQLite disk page explorer -
…https://github.com/nalgeon/sqlean/blob/main/docs/define.md#t... And my Go driver: https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/stateme... Mine is a strict port, though admittedly, this could be improved with additional pushdown.
comment by ncruces · 2025-01-29 · in Composable SQL -
…case, I think all you need to is to combine the existing reader VFS with zstd-seekable-format-go. https://github.com/ncruces/go-sqlite3/discussions/117#discus... For read/write, I'm honestly not sure. The Zipvfs is an… erm… architectural…
comment by ncruces · 2025-01-27 · in Supercharge SQLite with Ruby Functions -
…of extensions and a few custom VFSes that use the same APIs available to clients of the library. https://github.com/ncruces/go-sqlite3/tree/main/ext https://github.com/ncruces/go-sqlite3/tree/main/vfs#custom-v...
comment by ncruces · 2025-01-27 · in Supercharge SQLite with Ruby Functions -
…but this workflow should give you an idea of what was already possible with the existing runners: https://github.com/ncruces/go-sqlite3/blob/main/.github/work...
comment by ncruces · 2025-01-16 · in GitHub Linux ARM64 hosted runners now available for free in public repositories -
…emulation on Linux), others launching a VM. In particular, that's how I test the BSDs and Solaris. https://github.com/ncruces/go-sqlite3/wiki/Support-matrix
comment by ncruces · 2025-01-16 · in GitHub Linux ARM64 hosted runners now available for free in public repositories -
…one instance that doesn't know about checksums to modify a checksummed DB for it to appear corrupt. https://github.com/ncruces/go-sqlite3/tree/main/vfs#checksum... Weirdly, databases created with the macOS version of the sqlite3 CLI…
comment by ncruces · 2024-11-09 · in SQLite does not do checksums -
I'm the developer of the Wasm driver mentioned in the article: https://github.com/ncruces/go-sqlite3 The v0.20.x series (I just released v0.20.1) should improve this significantly . The driver was reserving lots of address space (with a…
comment by ncruces · 2024-11-06 · in GoToSocial WASM-based SQLite driver and BSD -
It gets even more amazing than that. Look at this bit from my GitHub Actions: https://github.com/ncruces/go-sqlite3/blob/fefee692dbfad39f6... I install QEMU (I have the same setup locally), then it's one line each to run unit tests for:…
comment by ncruces · 2024-10-19 · in Show HN: Go Plan9 Memo