sqlboiler-sqlite3 icon indicating copy to clipboard operation
sqlboiler-sqlite3 copied to clipboard

SQLite driver without CGO (modernc.org/sqlite)

Open abemedia opened this issue 4 years ago • 3 comments

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.

abemedia avatar Feb 27 '21 21:02 abemedia

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?

aarondl avatar Mar 14 '21 19:03 aarondl

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.

cryptix avatar Mar 16 '21 15:03 cryptix

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.

pojntfx avatar Jan 07 '22 19:01 pojntfx