Hacker GitHub

← All repos

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

Mentions per year 84 mentions · busiest year 2025 (35)
20082026
  1. Ongoing draft: https://github.com/ncruces/go-sqlite3/pull/438
    comment by ncruces · 2026-10-21 · in Two-Stack Sliding-Window Aggregation
  2. …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
  3. …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.
  4. 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
  5. …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
  6. …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
  7. And here it is: https://github.com/ncruces/go-sqlite3/pull/375
  8. 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!
  9. 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.
  10. …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
  11. …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...
  12. …require CGO (disclosure, I made the second one): https://pkg.go.dev/modernc.org/sqlite https://pkg.go.dev/github.com/ncruces/go-sqlite3
  13. …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...
  14. …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
  15. …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
  16. 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
  17. 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
  18. …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)…
  19. 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
  20. …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).
  21. …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
  22. …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…
  23. …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
  24. …Litestream v0.5.0 setup running. https://fly.io/blog/litestream-revamped/#lightweight-read-re... https://github.com/ncruces/go-sqlite3/tree/litestream/litest...
  25. …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
  26. …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
  27. …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?
  28. …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.
  29. …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
  30. …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
  31. 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?
  32. …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:…
  33. 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.…
  34. …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
  35. …my efforts here: https://news.ycombinator.com/item?id=43935284 Or, if you wanna jump to the code: https://github.com/ncruces/go-sqlite3/blob/main/sqlite3/libc...
    comment by ncruces · 2025-05-09 · in WASM 2.0
  36. …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
  37. 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
  38. …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
  39. 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
  40. …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...
  41. …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
  42. …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
  43. …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
  44. …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
  45. …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
  46. …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...
  47. …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
  48. …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
  49. 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…
  50. 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