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

sqlitetune

package
v1.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sqlitetune applies a consistent SQLite baseline to every physical connection opened through database/sql.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, db *sql.DB, options Options) error

Apply configures one physical connection from a caller-owned pool. Future connections in that pool remain the caller's responsibility; use Open when this package owns the pool and every physical connection must be configured.

func Open

func Open(dsn string, options Options) (*sql.DB, error)

Open returns a database/sql pool whose new SQLite connections are configured before they are handed to callers.

Types

type Options

type Options struct {
	PageSize              int
	ForeignKeys           bool
	BusyTimeout           time.Duration
	CacheSizeKB           int
	MMapSizeBytes         int64
	TempStoreMemory       bool
	CacheSpill            bool
	WALAutoCheckpoint     int
	JournalSizeLimitBytes int64
	Synchronous           SynchronousMode
}

Options configures the SQLite PRAGMAs applied to every physical connection. WAL mode is always enabled. Zero mmap size explicitly disables memory mapping; it is not treated as an unset value.

type SynchronousMode

type SynchronousMode string

SynchronousMode selects SQLite's synchronous durability mode.

const (
	// SynchronousNormal balances write throughput and durability in WAL mode.
	SynchronousNormal SynchronousMode = "NORMAL"
	// SynchronousOff favors throughput over durability.
	SynchronousOff SynchronousMode = "OFF"
	// SynchronousFull favors durability over write throughput.
	SynchronousFull SynchronousMode = "FULL"
)

Jump to

Keyboard shortcuts

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