I’m searching for a Go package deal that implements the official sql interface however shops all the pieces in a single file as I don’t want superior features.
It doesn’t have to behave like a SQL database requiring queries, drivers, or the like.
I imagine you’re searching for SQLite:
https://www.sqlite.org/index.html
And right here’s an article to get you began:
https://astaxie.gitbooks.io/build-web-application-with-golang/content material/en/05.3.html
@Willy I discovered https://github.com/mattn/go-sqlite3 a ache to make use of on some platforms as a result of it requires cgo
.
Fortunately there’s a conversion of this db-driver to pure go: https://pkg.go.dev/modernc.org/sqlite.
Many tutorials don’t point out this selection.
how do I affirm that modernc.org/sqlite implements the sql.DB interface? i don’t see it at a look.
AFAIK it’s a drop-in alternative of mattn/go-sqlite3
.
Right here’s a easy instance from the gitlab-repo: examples/example1/foremost.go · grasp · cznic / sqlite · GitLab
I’ve began utilizing GitHub – glebarez/go-sqlite: pure-Go SQLite driver for Go (SQLite embedded), didn’t understand there have been so many choices…
I had by no means discovered that one. Appears to be a fork of modernc
with slight modifications to make it extra appropriate with GORM: https://github.com/glebarez/go-sqlite/points/96.