volatiletech / sqlboiler-sqlite3

sqlite3 driver for sqlboiler
BSD 3-Clause "New" or "Revised" License
19 stars 16 forks source link

SQLite driver without CGO (modernc.org/sqlite) #11

Open abemedia opened 3 years ago

abemedia commented 3 years ago

There is a SQLite driver that doesn't use CGO: https://pkg.go.dev/modernc.org/sqlite

Using this it would be possible to move this driver into the main repo and avoid external dependencies.

aarondl commented 3 years ago

There's no really big reason to move it into the main repo. There's nothing special about being in there. The current binaries are all separate today and require a separate go install command and now thanks to Go 1.16 we can install them all in a very similar way - the only thing that changes a bit is the url. Is there any reason I've missed that makes it desirable?

cryptix commented 3 years ago

While I also got pretty excited about this and think cznic is doing the gopher gods work there, I'd advise everybody who wants to try this to check their issues page. Issue No 39 and the missing pragmas are enough for me to not jump ship immediately and let them solve the teething troubles first.

In the end this should act essentially the same anyhow and would just need a different sql.Open(...) to be passed into the generated models.

pojntfx commented 2 years ago

I've forked this driver and "ported" it to modernc.org/sqlite (it was really just replacing the imports) here: https://github.com/pojntfx/sqlboiler-sqlite3 and it works really well (I'm testing it for usage in https://github.com/pojntfx/stfs, as the current CGo solution leads to quite a few portability issues). Maybe one could implement this using a build flag of sorts? While the CGo-free SQLite version is quite useful, its not without its own problems in terms of portability (such as lack of RISC-V compatibility). If one disables the SQLBoiler-generated tests with no-tests: true it is however also possible to use this version of the driver by just importing modernc.org/sqlite.