db

package
v0.0.0-...-b036b97 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

internal/db/links.go

internal/db/notes.go

internal/db/nulltime.go

internal/db/projects.go

internal/db/sessions.go

internal/db/tags.go

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)

func (*DB) AddSessionTag

func (d *DB) AddSessionTag(sessionID int64, tag string) error

func (*DB) ArchiveProject

func (d *DB) ArchiveProject(id int64) error

func (*DB) Close

func (d *DB) Close() error

func (*DB) Conn

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

func (*DB) GetConversationDigest

func (d *DB) GetConversationDigest(sessionID int64) (string, error)

func (*DB) GetDistinctSessionDates

func (d *DB) GetDistinctSessionDates() ([]string, error)

func (*DB) GetLatestSession

func (d *DB) GetLatestSession(projectID int64) (*Session, error)

func (*DB) GetLinkedProjects

func (d *DB) GetLinkedProjects(projectID int64) ([]Project, error)

func (*DB) GetProjectByName

func (d *DB) GetProjectByName(name string) (*Project, error)

func (*DB) GetProjectByPath

func (d *DB) GetProjectByPath(path string) (*Project, error)

func (*DB) GetSessionsInRange

func (d *DB) GetSessionsInRange(projectID int64, since, until time.Time) ([]Session, error)

func (*DB) HasOverlappingSession

func (d *DB) HasOverlappingSession(projectID int64, start, end time.Time) (bool, error)

func (*DB) InsertConversationDigest

func (d *DB) InsertConversationDigest(sessionID int64, digestJSON string) error

func (*DB) InsertNote

func (d *DB) InsertNote(n Note) (int64, error)

func (*DB) InsertSession

func (d *DB) InsertSession(s Session) (int64, error)

func (*DB) LinkProjects

func (d *DB) LinkProjects(projectID, linkedProjectID int64) error

func (*DB) ListDirtyProjects

func (d *DB) ListDirtyProjects() ([]Project, error)

func (*DB) ListNotes

func (d *DB) ListNotes(projectID int64, limit int) ([]Note, error)

func (*DB) ListProjects

func (d *DB) ListProjects(status string) ([]Project, error)

func (*DB) ListSessionTags

func (d *DB) ListSessionTags(sessionID int64) ([]string, error)

func (*DB) ListSessions

func (d *DB) ListSessions(f SessionFilter) ([]Session, error)

func (*DB) ListSessionsByTag

func (d *DB) ListSessionsByTag(tag string) ([]Session, error)

func (*DB) RemoveSessionTag

func (d *DB) RemoveSessionTag(sessionID int64, tag string) error

func (*DB) SearchNotes

func (d *DB) SearchNotes(query string) ([]Note, error)

func (*DB) SearchSessions

func (d *DB) SearchSessions(query string) ([]Session, error)

func (*DB) SessionExists

func (d *DB) SessionExists(claudeSessionID string) (bool, error)

func (*DB) UnlinkProjects

func (d *DB) UnlinkProjects(projectID, linkedProjectID int64) error

func (*DB) UpsertProject

func (d *DB) UpsertProject(p Project) (int64, error)

type Note

type Note struct {
	ID        int64
	ProjectID *int64
	SessionID *int64
	Content   string
	CreatedAt time.Time
}

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool
}

NullTime is a time.Time that is stored as a Unix timestamp in SQLite rather than the Go default string format. This allows proper round-tripping through the modernc.org/sqlite driver.

func ToNullTime

func ToNullTime(t *time.Time) NullTime

ToNullTime converts a *time.Time to NullTime

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements sql.Scanner.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements driver.Valuer.

type Project

type Project struct {
	ID            int64
	Name          string
	Path          string
	Languages     string
	Branch        string
	Dirty         bool
	DirtyFiles    int
	LastCommitAt  NullTime
	LastCommitMsg string
	Ahead         int
	Behind        int
	Status        string
	DiscoveredAt  NullTime
	LastScannedAt NullTime
}

type Session

type Session struct {
	ID              int64
	ProjectID       int64
	ClaudeSessionID string
	StartedAt       *time.Time
	EndedAt         *time.Time
	DurationSecs    int
	Summary         string
	FilesChanged    string
	CommitsMade     string
	Tags            string
	Source          string
	CreatedAt       time.Time
	// Joined fields
	ProjectName string
}

type SessionFilter

type SessionFilter struct {
	ProjectID int64
	Since     *time.Time
	Limit     int
}

Jump to

Keyboard shortcuts

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