workspacedb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package workspacedb owns per-workspace SQLite database lifecycle helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB is an open per-workspace AGH database handle.

func Open

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

Open resolves the workspace identity and opens <workspace>/.agh/agh.db.

func OpenWorkspace

func OpenWorkspace(ctx context.Context, workspaceRoot string, migrations []store.Migration) (*DB, error)

OpenWorkspace opens a workspace database with the default migration table.

func (*DB) Close

func (d *DB) Close(ctx context.Context) error

Close checkpoints the WAL and closes the database.

func (*DB) DB

func (d *DB) DB() *sql.DB

DB exposes the underlying SQL handle for storage packages.

func (*DB) Path

func (d *DB) Path() string

Path reports the database path.

func (*DB) WorkspaceID

func (d *DB) WorkspaceID() string

WorkspaceID reports the resolved workspace identity.

func (*DB) WorkspaceRoot

func (d *DB) WorkspaceRoot() string

WorkspaceRoot reports the workspace root used to open the database.

type Options

type Options struct {
	WorkspaceRoot   string
	Migrations      []store.Migration
	MigrationsTable string
}

Options configures a per-workspace database open.

Jump to

Keyboard shortcuts

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