# README
sqliteshim
sqliteshim automatically imports modernc.org/sqlite or mattn/go-sqlite3 depending on your platform.
Currently sqliteshim uses packages in the following order:
- modernc.org/sqlite on supported platforms.
- mattn/go-sqlite3 if Cgo is enabled.
Otherwise it registers a driver that returns an error on unsupported platforms.
You can install sqliteshim with:
go get github.com/uptrace/bun/driver/sqliteshim
And then create a sql.DB
:
sqldb, err := sql.Open(sqliteshim.ShimName, "file::memory:?cache=shared")
Alternatively you can also use sqliteshim.DriverName
:
if sqliteshim.HasDriver() {
sqldb, err := sql.Open(sqliteshim.DriverName(), "file::memory:?cache=shared")
}
# Functions
Driver returns the shim driver registered under ShimName name.
DriverName is the name of the database/sql driver.
HasDriver indicates that SQLite driver implementation is available.
# Constants
ShimName is the name of the shim database/sql driver registration.
# Structs
UnsupportedError is returned from driver on unsupported platforms.