sqlitedsn

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 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.

Documentation

Overview

Package sqlitedsn finds the file a database/sql SQLite data source name opens, so an app can register the same database it opens:

dsn := "file:data/app.sqlite?_pragma=journal_mode(WAL)"
db, err := sql.Open("sqlite", dsn)
path, err := sqlitedsn.Modernc(dsn)
_, err = client.StartBackup(ctx, path, nil)

It follows each driver's own parsing and SQLite's URI rules, and refuses in-memory and temporary databases, which have no file to back up. It imports no driver.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFile = errors.New(
	"the DSN opens an in-memory or temporary database, which " +
		"has no file to back up; open it from a path",
)

ErrNoFile reports a DSN that opens an in-memory or temporary database.

Functions

func Mattn

func Mattn(dsn string) (string, error)

Mattn returns the absolute path of the file github.com/mattn/go-sqlite3 (driver "sqlite3") opens for dsn. Relative paths resolve against the working directory.

func Modernc

func Modernc(dsn string) (string, error)

Modernc returns the absolute path of the file modernc.org/sqlite (driver "sqlite") opens for dsn. Relative paths resolve against the working directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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