db

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

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
}

func Open

func Open(path string) (*DB, error)

Open creates or opens the SQLite database.

func (*DB) AllSessions

func (db *DB) AllSessions(sortBy string, desc bool) ([]Session, error)

AllSessions returns sessions sorted by the given field.

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection.

func (*DB) PruneUnseen

func (db *DB) PruneUnseen(currentIDs []string) (int64, error)

PruneUnseen deletes sessions that were not part of the current scan. This handles deleted sessions, removed scan paths, etc.

func (*DB) Search

func (db *DB) Search(query string) ([]Session, error)

Search returns sessions matching a text query across multiple fields.

func (*DB) Upsert

func (db *DB) Upsert(sessions []scanner.Session) error

Upsert inserts or updates sessions from a scan. Preserves title/summary.

type Session

type Session struct {
	SessionID       string
	ProjectName     string
	ProjectPath     string
	ClaudeDir       string
	FirstPrompt     string
	ExistingSummary string
	Title           string
	Summary         string
	MessageCount    int
	Created         time.Time
	Modified        time.Time
	GitBranch       string
	IsSidechain     bool
	JSONLPath       string
	LastScanned     time.Time
	SummarizedAt    time.Time
}

Session is the DB representation, extending scanner.Session with AI-generated fields.

Jump to

Keyboard shortcuts

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