sqlite

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 7 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 sqlite is a `sqlite` implementation for Go Hosts on github.com/ncruces/go-sqlite3, which bundles SQLite and needs no cgo (chapter 9, `sqlite` Host obligations; ADR 0070). None of this is the Core: a Host passes Databases to Core.SqliteCapability.

One database is one Segment Coordinator, shared by every `sqlite` Grant on it. A Segment's first write takes the one writer connection and opens its transaction; every other read goes through a read-only connection, which in WAL mode sees the last committed state. The write lock lives in this process, so the process owns the file: it holds an exclusive lock on a sidecar database, `<path>-lock`, until it closes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Databases

func Databases(databases map[string]*Database) talk.SqliteImpl

Databases is the implementation over the Host's databases, by the name a binding gives. A binding naming no database maps to no coordinator, which the Grant refuses.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is one database a Host offers through `sqlite`. Its methods are safe for concurrent use: calls from every Group take turns.

func Open

func Open(path string) (*Database, error)

Open opens or creates the database at path, which the process holds until Close.

func (*Database) Close

func (d *Database) Close() error

Close closes the database, discarding any Segment's uncommitted changes.

func (*Database) Coordinator

func (d *Database) Coordinator() *talk.SegmentLifecycle

Coordinator is the Segment Coordinator every Grant on the database shares.

func (*Database) Exec

func (d *Database) Exec(sql string) error

Exec runs SQL directly, outside every Segment and with no authorizer, as for a migration.

Jump to

Keyboard shortcuts

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