NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
SQLite transactions and virtual tables (misfra.me)
dvektor 7 hours ago [-]
Love to see someone writing about vtabs, I implemented vtab support for a rust reimplementation of sqlite so I've recently learned a tremendous amount about them. They are very powerful and probably under utilized.
Jupe 15 hours ago [-]
Interesting. But this uses mattn's go-sqlite3 package, which is CGO.

Is this a normal/expected requirement in modern GO?

ncruces 15 hours ago [-]
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 mattn CGO driver actually doesn't seem to support wrapping the xBegin/xSync/xRollback/xCommit methods. Mine actually does, although it's largely untested, as I haven't needed this yet.

preetamjinka 15 hours ago [-]
We use mattn's go-sqlite3 in our SaaS product. It's not ideal from a toolchain perspective (i.e. cross compiling becomes a little annoying, especially with multi-arch Docker images) but once you get across that hurdle, we haven't run into any major problems with cgo.
hamburglar 12 hours ago [-]
The problem with cgo is it reduces portability, not that it causes issues. If whatever C you’re invoking doesn’t build on your architecture or if you need to cross-compile (last I checked), you’re out of luck.
cryptonector 8 hours ago [-]
I bet SQLite3 builds on more platforms than Go.
catlifeonmars 7 hours ago [-]
It’s not about the build platform, it’s about the execution platform and not having to have a toolchain for every platform. This is especially relevant in the embedded space.
cryptonector 8 hours ago [-]
There is no pure Go implementation of SQLite3 so...
ncruces 8 hours ago [-]
There's at 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.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 10:18:25 GMT+0000 (Coordinated Universal Time) with Vercel.