-
-
Notifications
You must be signed in to change notification settings - Fork 240
Open
Labels
Description
We're currently using the pure Go glebarez/go-sqlite. It is based on modernc.org/sqlite, which is essentially SQLite transpiled from C to Go using some elaborate transpiler they came up with.
As an alternative, there is ncruces/go-sqlite3, which follows a different approach. It uses the official SQLite WebAssembly build and runs it inside a pure Go WASM runtime (wazero).
Both come with a GORM driver.
I think the latter approach is the "cleaner" one and after having read through both implementations, I think the ncruces variant seems more robust (e.g. has super robust handling of different time formats). Also, in a quick load test, Wakapi ran ~ 10 % faster with it.
A few thing to consider:
- Time formats: The ncruces driver uses
time.RFC3339Nanofor time encoding by default (remember, SQLite doesn't have a native timestamp column type), while most other SQLite implementations use this format instead. While the ncruces driver does an amazing job at being very tolerant about different time formats, out current driver is a bit more strict there. As a consequence, an already existing database can well be read fine after switching to the new driver, but if we ever wanted to go back, we'd have to migrate timestamps manually (see query below). Luckily, the ncruces driver supports custom time formats as a query parameter though, so we can probably just instruct it to keep using out current format. - ... ?