Help us shape the future of Go! Take the 2026 Go Developer Survey

sqlite

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sqlite opens the SQLite databases hive and Hive Desktop keep, with the DSN and pool settings every caller must agree on.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, path string, opts Options) (*sql.DB, error)

Open opens the database at path in WAL mode with foreign keys on, applies the pool settings, and pings it. The caller owns migrations and defaults.

Write transactions begin with BEGIN IMMEDIATE (_txlock=immediate). Several writers, in one process or across the CLI and the desktop, run transactions that read before they write. With the driver default (deferred), two such transactions can both hold a read lock and then both try to upgrade to the write lock. SQLite resolves that deadlock by returning SQLITE_BUSY at once and ignoring busy_timeout, because waiting could never succeed. IMMEDIATE takes the write lock up front, so a second writer waits on busy_timeout instead of failing.

Types

type Options

type Options struct {
	MaxOpenConns int
	MaxIdleConns int
	BusyTimeout  time.Duration
}

Jump to

Keyboard shortcuts

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