Hacker News new | ask | show | jobs
by jasonthorsness 520 days ago
CSV database is interesting; probably the most trivially-debuggable a database can possibly be. Although why not SQLite? CSV is not very resistant corruption if host crashes midway through a write.
1 comments

No dependencies apart from the standard library is my guess.
Go doesn’t have sqlite in the stdlib?
It doesn’t and using the standard 3rd party package requires compiling with CGO which is a pain for cross-platform :(
theoretically there is a go port of sqlite by either using wazero[1] (wasm runtime) and then using sqlite from there or some modernc package[2](i am not sure what this website is except for the sqlite part, so maybe someone can clarify that though) There was also this wrapper of sorts to make the wazero thing genuinely easier to do and it was on r/golang but I don't remember its name but I do think it is semi popular.

[1]wazero:https://wazero.io/ [2]:https://pkg.go.dev/modernc.org/sqlite

For 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

Yes btw if I may ask, how does the modernc code actually work and like, if I wanted my code to be minimalist, what should I rather pick?

Also didn't expect that I would be talking to the author of wazero myself haha. I really admire your project.

There is a CGO-free package for the basics: https://gitlab.com/cznic/sqlite

Not 100% drop-in though. I’ve hit some snags around VFS support.

Define cross platform here?

I’ve heard this complaint but have yet to have an issue deploying to Linux/MacOS/Windows on arm or x86 using CGO backed libraries.

Maybe if you truly are targeting some niche platform but then you likely have some other issues to contend with and where are you deploying to?