You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wakapi uses SQLite as its default database via mattn/go-sqlite3 and the official GORM driver go-gorm/sqlite. SQLite is implemented in C, so if used in a project, the project must be compiled with CGO_ENABLED=1. That, in turn, requires to have a C-compiler (like gcc or mingw) installed and generally caused a bunch of problems in the past (e.g. when it comes to cross-compilation).
For quite a while, I was looking out for an implementation of SQLite that is in pure Go - so we can get rid of cgo - and eventually found glebarez/go-sqlite, which is based on cznic/sqlite, plus glebarez/sqlite as a compatible GORM driver (relationship among these packages explained here). The base package is actually a transpiled version of the original C code. Note that mattn/go-sqlite3 is still included as a dependency, but apparently only for testing (or so?), so you can well compile without cgo.
The package claims to be fully compatible with the reference implementation and able to act as a drop-in replacement, but comes with a downside in performance (see benchmarks). I'd assume that you wouldn't recognize the worse performance with average Wakapi setups, though.
Since replacing the database implementation is quite a big change, I need your help here! If you're currently self-hosting Wakapi with an SQLite database, it would be super helpful if you could test the new, C-free version as part of your setup. Backup your database (just in case), replace the original Wakapi binary with the one below, keep using Wakapi for a couple of days, see if any errors occur and report them back. Thank you! 馃檹
muety
changed the title
Replace SQLite with pure Go implementation (need your help!)
馃憠 Replace SQLite with pure Go implementation (need your help!) 馃憟
Sep 8, 2022
Wakapi uses SQLite as its default database via mattn/go-sqlite3 and the official GORM driver go-gorm/sqlite. SQLite is implemented in C, so if used in a project, the project must be compiled with
CGO_ENABLED=1
. That, in turn, requires to have a C-compiler (likegcc
ormingw
) installed and generally caused a bunch of problems in the past (e.g. when it comes to cross-compilation).For quite a while, I was looking out for an implementation of SQLite that is in pure Go - so we can get rid of cgo - and eventually found glebarez/go-sqlite, which is based on cznic/sqlite, plus glebarez/sqlite as a compatible GORM driver (relationship among these packages explained here). The base package is actually a transpiled version of the original C code. Note that mattn/go-sqlite3 is still included as a dependency, but apparently only for testing (or so?), so you can well compile without cgo.
The package claims to be fully compatible with the reference implementation and able to act as a drop-in replacement, but comes with a downside in performance (see benchmarks). I'd assume that you wouldn't recognize the worse performance with average Wakapi setups, though.
Since replacing the database implementation is quite a big change, I need your help here! If you're currently self-hosting Wakapi with an SQLite database, it would be super helpful if you could test the new, C-free version as part of your setup. Backup your database (just in case), replace the original Wakapi binary with the one below, keep using Wakapi for a couple of days, see if any errors occur and report them back. Thank you! 馃檹
Compiled locally, doing:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-w -s' -o wakapi_windows_amd64.exe
Code can be found at the
sqlite-go-replacement
branch.The text was updated successfully, but these errors were encountered: