sqlite

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sqlite opens an artifactweave store on SQLite through the pure-Go modernc.org/sqlite driver, so the server builds without CGO on every platform (decision 0004).

Transactions begin IMMEDIATE, taking the write lock up front; with WAL and a busy timeout this serialises writers without deadlocks, and readers keep reading while one writes.

Index

Constants

View Source
const Memory = ":memory:"

Memory is the path that opens a private in-memory database.

Variables

View Source
var Dialect = sqlcommon.Dialect{
	Name:              "sqlite",
	Migrations:        sqlcommon.MustSub(migrationFS, "migrations"),
	IsUniqueViolation: IsUniqueViolation,
}

Dialect is SQLite's sqlcommon.Dialect.

View Source
var ErrPathRequired = errors.New("sqlite: path is required")

ErrPathRequired is returned by Open for an empty path.

Functions

func DSN

func DSN(path string, o Options) string

DSN builds the modernc connection string for path.

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation reports SQLite unique and primary-key failures.

func Open

func Open(ctx context.Context, path string, o Options) (*sqlcommon.Store, error)

Open opens (creating if needed) and migrates the database at path. The path Memory opens a private in-memory database, held on one connection because each connection to ":memory:" would otherwise see its own empty database.

Types

type Options

type Options struct {
	sqlcommon.Options
	// BusyTimeout bounds lock waits; 10s when zero.
	BusyTimeout time.Duration
}

Options configures Open.

Jump to

Keyboard shortcuts

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