sqlite

package
v1.0.0-alpha.24 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeConfig

func DecodeConfig(input any) (database.Dialect, error)

DecodeConfig parses a SQLite path string or a map with "path" / "dsn".

Types

type Config

type Config struct {
	// Path is a filesystem path to the database file, or ":memory:" for an
	// in-memory database. Directories are created on Connect (0o700); the DB
	// file and WAL/SHM siblings are tightened to 0o600 after open.
	// ":memory:" is process-local: each Connect gets an isolated shared-cache
	// database (unique URI name), not a process-wide singleton.
	Path string
	// DSN is a full modernc.org/sqlite DSN. When set, it takes precedence over
	// Path. Required pragmas from Path mode (_txlock, foreign_keys,
	// case_sensitive_like, …) are merged into the DSN when missing so callers
	// do not silently get SQLite defaults (FK off, case-insensitive LIKE).
	DSN string
}

Config holds the SQLite database path (or DSN).

func (Config) Connect

func (c Config) Connect(ctx context.Context) (database.Pool, error)

Connect implements database.Dialect.

func (Config) Name

func (c Config) Name() string

Name implements database.Dialect.

type Pool

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

Pool wraps a *sql.DB and implements database.Pool and service.Pool.

func (*Pool) Close

func (p *Pool) Close(_ context.Context) error

Close implements database.Pool.

func (Pool) IsStatements

func (s Pool) IsStatements()

IsStatements implements service.Statements.

func (*Pool) Migrate

func (p *Pool) Migrate(ctx context.Context) error

Migrate implements database.Pool.

func (Pool) NewManagedID

func (s Pool) NewManagedID(prefix string) (string, error)

func (*Pool) Ping

func (p *Pool) Ping(ctx context.Context) error

Ping implements database.Pool.

func (*Pool) Statements

func (p *Pool) Statements() service.AllStatements

Statements implements service.Statementer.

func (*Pool) Transaction

func (p *Pool) Transaction(ctx context.Context, fn func(ctx context.Context, tx service.Statementer[service.AllStatements]) error) error

Transaction implements service.Transactioner.

Directories

Path Synopsis
Package migration applies SQLite schema migrations using goose.
Package migration applies SQLite schema migrations using goose.

Jump to

Keyboard shortcuts

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