sqliteshim

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: BSD-2-Clause Imports: 3 Imported by: 201 modules, 161 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sqliteshim

PkgGoDev

sqliteshim automatically imports modernc.org/sqlite or mattn/go-sqlite3 depending on your platform.

Currently sqliteshim uses packages in the following order:

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")
}

Documentation

Overview

Package sqliteshim is a shim package that imports an appropriate sqlite driver for the build target and registers it under ShimName.

Currently it uses packages in the following order:

  • modernc.org/sqlite on supported platforms,
  • github.com/mattn/go-sqlite3 if Cgo is enabled,

Otherwise registers a driver that returns an error on unsupported platforms.

Index

Constants

View Source
const ShimName = "sqliteshim"

ShimName is the name of the shim database/sql driver registration.

Variables

This section is empty.

Functions

func Driver

func Driver() driver.Driver

Driver returns the shim driver registered under ShimName name.

func DriverName

func DriverName() string

DriverName is the name of the database/sql driver. Note that unlike ShimName the value depends on the build target. That is, DriverName returns the name of the underlying database driver.

func HasDriver

func HasDriver() bool

HasDriver indicates that SQLite driver implementation is available.

Types

type UnsupportedError

type UnsupportedError struct{}

UnsupportedError is returned from driver on unsupported platforms.

func (*UnsupportedError) Error

func (e *UnsupportedError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL