Describe the feature

Driver for https://pkg.go.dev/modernc.org/sqlite

Motivation

So that we can use a sqlite DB without needing CGO. This makes cross compilation much easier.

Related Issues

https://pkg.go.dev/modernc.org/sqlite

Comment From: yevgenypats

@amnonbc here it is https://github.com/cloudquery/sqlite

Note: the modernc.org sqlite client is not supporting a lot of features so it will work for very basic use-cases.

Comment From: amnonbc

@amnonbc here it is https://github.com/cloudquery/sqlite

Note: the modernc.org sqlite client is not supporting a lot of features so it will work for very basic use-cases.

Thanks @yevgenypats ! I tried this as a drop in replacement for gorm.io/driver/sqlite, and everything except aggregates just works.

Comment From: notnil

Can this be merged into Gorm itself?

Comment From: olliepotter

Just pitching in and saying I would absolutely love this to be officially supported. Going to give this a try.

Comment From: ghost

The mattn/go-sqlite3 driver has a problem , which affect me , the string will sometime auto convert to Float.. very strange. So we shall official support pure golang driver for sqlite? i tested it , works as normal.

https://github.com/mattn/go-sqlite3/issues/970

Comment From: glebarez

I ported this to pure-go SQLite implementation, and it works just fine in unit-testing purposes. https://github.com/glebarez/sqlite

Comment From: muety

Just came across this post in search for a pure Go implementation of SQLite. From my understanding, cznic/sqlite is the only one currently? glebarez/go-sqlite then seems to build on top of that (👉 what is the difference?) and glebarez/sqlite is the compatible GORM driver. Is that about correct?

Is anyone using these "in production" in their projects? What is your experience with these? Can this be used as a fully-fledged drop-in replacement for mattn/go-sqlite3 + go-gorm/sqlite?

Comment From: glebarez

modernc.org/sqlite consists of:

  • pure go implementation of SQLite (original C codebase is regularly transpiled into Go with great tools from modernc.org
  • implementation for golang database/sql driver interface as described in https://pkg.go.dev/database/sql/driver

glebarez/go-sqlite: is just a fork of modernc/sqlite with slight changes in the driver part (2), to behave more closely to mattn’s CGo version (https://github.com/mattn/go-sqlite3). this slight changes allowed it to be fully compatible with GORM (the GORM driver is in https://github.com/glebarez/sqlite)

Comment From: muety

Thanks for clarifying!