A CGo-free port of SQLite/SQLite3
Posted by tosh 2 days ago
Comments
Comment by jsherer 2 days ago
1. gitlab.com/cznic/sqlite is the primary repo
2. github.com/cznic/sqlite was the github mirror but it moved
3. github.com/mordernc-org/sqlite is the read-only mirror of the primary repo
Cheers!
Comment by porjo 2 days ago
Typo, should be: github.com/modernc-org/sqlite
Comment by ncruces 2 days ago
It's a somewhat less faithful translation, since I manually ported the VFS (SQLite OS abstraction layer).
OTOH, each SQLite connection is sandboxed (can't access/corrupt Go memory, or other SQLite connections). And it should run everywhere Go runs.
Comment by yodon 2 days ago
Comment by tptacek 2 days ago
Comment by gnabgib 2 days ago
2023: Go port of SQLite without CGo (255 points, 118 comments) https://news.ycombinator.com/item?id=35488980
2020: Cznic/sqlite: Sqlite in pure Golang (no CGO) (6 points, not interesting for discussion.. this project is old) https://news.ycombinator.com/item?id=24358826
(7 other similar submissions)
Comment by tptacek 2 days ago
Comment by downrightmike 2 days ago
Comment by 9rx 2 days ago
Comment by usrnm 2 days ago
Comment by ameliaquining 2 days ago
Comment by ivanjermakov 2 days ago
Comment by 10000truths 2 days ago
Comment by ameliaquining 2 days ago
Comment by tptacek 2 days ago
Comment by spwa4 2 days ago
Comment by 0x20cowboy 2 days ago
Comment by blubber 2 days ago
Comment by usrnm 2 days ago
Comment by anupcshan 2 days ago
Comment by dizhn 2 days ago
Comment by agwa 2 days ago
-tags netgo,osusergo -linkmode external -extldflags -static
I regularly compile (cross-compile, even) static Go binaries that use the cgo sqlite package. But it's certainly a lot simpler if you can avoid cgo.
Comment by usrnm 2 days ago
Comment by Ferret7446 2 days ago
Comment by anupcshan 2 days ago
Comment by figmert 2 days ago
Comment by raggi 2 days ago
but the overheads also stack up, the database/sql api is fairly allocation heavy too unless you do a lot of work and that friction increases quite a bit with the ffi boundary.
this is not to suggest “modernc is faster” - it’s not for a lot a workloads.
there are opportunities for optimization all over both approaches.
Comment by pstuart 2 days ago
Comment by vicek22 2 days ago
Comment by spwa4 2 days ago
Comment by pjjpo 1 day ago
Comment by ftgffsdddr 2 days ago
Comment by zzo38computer 2 days ago
However, there are some work arounds to some situations. Git could (presumably) still be used, if you have that (although you might not want the entire repository and only some files, so that is a possible issue with this). If you have a URL of a specific file that you can change "blob" to "raw" in the URL to access the raw file (this works on other services as well and is not specific to Gitlab). For commits, you can add ".patch" or ".diff" on the end of the URL (this also is not specific to Gitlab).
Comment by qweqwe14 2 days ago
Comment by slopinthebag 2 days ago