sqlite

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(h *Handle) error

func EnsureRepository

func EnsureRepository(ctx context.Context, q *sqldb.Queries, rootPath string) (string, error)

func MigratePath

func MigratePath(ctx context.Context, dbPath string) error

MigratePath opens a temporary connection, runs migrations, and closes it. Used by tests that need a migrated DB without a full Handle.

func NullInt64

func NullInt64(v int64) sql.NullInt64

NullInt64 returns a valid sql.NullInt64 if v > 0, otherwise null.

func NullStr

func NullStr(s string) sql.NullString

NullStr returns a valid sql.NullString if s is non-empty, otherwise null.

func ResolveCheckpointID

func ResolveCheckpointID(ctx context.Context, q *sqldb.Queries, repoID, id string) (string, error)

ResolveCheckpointID resolves a (possibly abbreviated) checkpoint ID to its full UUID. If id is already 36 characters it is treated as an exact match via GetCheckpointByID. Otherwise, the prefix is matched against the repository's checkpoints; an error is returned when zero or more than one checkpoint matches.

func ResolveSessionID

func ResolveSessionID(ctx context.Context, q *sqldb.Queries, repoID, id string) (string, error)

ResolveSessionID resolves a (possibly abbreviated) session ID to its full UUID. Mirrors ResolveCheckpointID but queries agent_sessions.

func RollbackTx

func RollbackTx(tx *sql.Tx)

Types

type Handle

type Handle struct {
	DB      *sql.DB
	Queries *sqldb.Queries
}

func Open

func Open(ctx context.Context, dbPath string, opts OpenOptions) (*Handle, error)

type OpenOptions

type OpenOptions struct {
	BusyTimeout time.Duration
	Synchronous string
}

func DefaultOpenOptions

func DefaultOpenOptions() OpenOptions

DefaultOpenOptions returns fail-fast SQLite settings for hook, broker, worker, and background paths that retry or defer work on lock contention.

func UserFacingOpenOptions added in v0.5.2

func UserFacingOpenOptions() OpenOptions

UserFacingOpenOptions returns patient SQLite settings for commands where a user is waiting for a local result. These commands can race with the post-commit worker's writer lock, so they wait longer than hook and worker paths before returning SQLITE_BUSY.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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