sqlite

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package sqlite implements the storage interface using SQLite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHierarchicalID

func IsHierarchicalID(id string) (isHierarchical bool, parentID string)

IsHierarchicalID checks if an issue ID is hierarchical (has a parent). Hierarchical IDs have the format {parentID}.{N} where N is a numeric child suffix. Returns true and the parent ID if hierarchical, false and empty string otherwise.

func MigrationVersion

func MigrationVersion(db *sql.DB) (int64, error)

MigrationVersion returns the current migration version.

func RunMigrations

func RunMigrations(db *sql.DB) error

RunMigrations applies all pending database migrations.

Types

type Store

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

Store implements the storage.Storage interface using SQLite.

func New

func New(path string) (*Store, error)

New creates a new SQLite store at the given path. If the path is empty, uses ~/.arc/data.db

func (*Store) AddComment

func (s *Store) AddComment(ctx context.Context, issueID, author, text string) (*types.Comment, error)

AddComment adds a comment to an issue.

func (*Store) AddDependency

func (s *Store) AddDependency(ctx context.Context, dep *types.Dependency, actor string) error

AddDependency adds a dependency between two issues.

func (*Store) AddLabelToIssue

func (s *Store) AddLabelToIssue(ctx context.Context, issueID, label, actor string) error

AddLabelToIssue adds a label to an issue.

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) CloseIssue

func (s *Store) CloseIssue(ctx context.Context, id string, reason string, actor string) error

CloseIssue closes an issue.

func (*Store) CreateIssue

func (s *Store) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error

CreateIssue creates a new issue. If ParentID is set, generates a hierarchical child ID (e.g., parent.1) and automatically creates a parent-child dependency.

func (*Store) CreateLabel

func (s *Store) CreateLabel(ctx context.Context, label *types.Label) error

CreateLabel creates a new label definition.

func (*Store) CreateWorkspace

func (s *Store) CreateWorkspace(ctx context.Context, ws *types.Workspace) error

CreateWorkspace creates a new workspace.

func (*Store) DeleteComment

func (s *Store) DeleteComment(ctx context.Context, commentID int64) error

DeleteComment deletes a comment.

func (*Store) DeleteIssue

func (s *Store) DeleteIssue(ctx context.Context, id string) error

DeleteIssue deletes an issue.

func (*Store) DeleteLabel

func (s *Store) DeleteLabel(ctx context.Context, workspaceID, name string) error

DeleteLabel deletes a label.

func (*Store) DeleteWorkspace

func (s *Store) DeleteWorkspace(ctx context.Context, idOrName string) error

DeleteWorkspace deletes a workspace and all its issues. Accepts either workspace ID (e.g., "ws-00blnw") or name (e.g., "my-project-a1b2c3").

func (*Store) GetBlockedIssues

func (s *Store) GetBlockedIssues(ctx context.Context, filter types.WorkFilter) ([]*types.BlockedIssue, error)

GetBlockedIssues returns issues that are blocked by other issues.

func (*Store) GetComments

func (s *Store) GetComments(ctx context.Context, issueID string) ([]*types.Comment, error)

GetComments returns all comments for an issue.

func (*Store) GetDependencies

func (s *Store) GetDependencies(ctx context.Context, issueID string) ([]*types.Dependency, error)

GetDependencies returns the dependencies of an issue.

func (*Store) GetDependents

func (s *Store) GetDependents(ctx context.Context, issueID string) ([]*types.Dependency, error)

GetDependents returns issues that depend on the given issue.

func (*Store) GetEvents

func (s *Store) GetEvents(ctx context.Context, issueID string, limit int) ([]*types.Event, error)

GetEvents returns the event history for an issue.

func (*Store) GetIssue

func (s *Store) GetIssue(ctx context.Context, id string) (*types.Issue, error)

GetIssue retrieves an issue by ID.

func (*Store) GetIssueByExternalRef

func (s *Store) GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error)

GetIssueByExternalRef retrieves an issue by its external reference.

func (*Store) GetIssueDetails

func (s *Store) GetIssueDetails(ctx context.Context, id string) (*types.IssueDetails, error)

GetIssueDetails retrieves an issue with all its relational data.

func (*Store) GetIssueLabels

func (s *Store) GetIssueLabels(ctx context.Context, issueID string) ([]string, error)

GetIssueLabels returns all labels for an issue.

func (*Store) GetLabel

func (s *Store) GetLabel(ctx context.Context, workspaceID, name string) (*types.Label, error)

GetLabel retrieves a label by workspace and name.

func (*Store) GetLabelsForIssues

func (s *Store) GetLabelsForIssues(ctx context.Context, issueIDs []string) (map[string][]string, error)

GetLabelsForIssues fetches labels for multiple issues in a single query. Returns a map of issue_id -> []labels

func (*Store) GetNextChildID

func (s *Store) GetNextChildID(ctx context.Context, parentID string) (string, error)

GetNextChildID generates the next hierarchical child ID for a given parent. Returns formatted ID as parentID.{counter} (e.g., arc-a3f8e9.1)

func (*Store) GetReadyWork

func (s *Store) GetReadyWork(ctx context.Context, filter types.WorkFilter) ([]*types.Issue, error)

GetReadyWork returns issues that are ready to work on (not blocked).

func (*Store) GetStatistics

func (s *Store) GetStatistics(ctx context.Context, workspaceID string) (*types.Statistics, error)

GetStatistics returns aggregate statistics for a workspace.

func (*Store) GetWorkspace

func (s *Store) GetWorkspace(ctx context.Context, id string) (*types.Workspace, error)

GetWorkspace retrieves a workspace by ID.

func (*Store) GetWorkspaceByName

func (s *Store) GetWorkspaceByName(ctx context.Context, name string) (*types.Workspace, error)

GetWorkspaceByName retrieves a workspace by name.

func (*Store) GetWorkspaceByPath

func (s *Store) GetWorkspaceByPath(ctx context.Context, path string) (*types.Workspace, error)

GetWorkspaceByPath retrieves a workspace by its file system path.

func (*Store) IsBlocked

func (s *Store) IsBlocked(ctx context.Context, issueID string) (bool, []string, error)

IsBlocked checks if an issue is blocked by any open issues.

func (*Store) ListIssues

func (s *Store) ListIssues(ctx context.Context, filter types.IssueFilter) ([]*types.Issue, error)

ListIssues returns issues matching the filter.

func (*Store) ListLabels

func (s *Store) ListLabels(ctx context.Context, workspaceID string) ([]*types.Label, error)

ListLabels returns all labels for a workspace.

func (*Store) ListWorkspaces

func (s *Store) ListWorkspaces(ctx context.Context) ([]*types.Workspace, error)

ListWorkspaces returns all workspaces.

func (*Store) Path

func (s *Store) Path() string

Path returns the database file path.

func (*Store) RemoveDependency

func (s *Store) RemoveDependency(ctx context.Context, issueID, dependsOnID string, actor string) error

RemoveDependency removes a dependency between two issues.

func (*Store) RemoveLabelFromIssue

func (s *Store) RemoveLabelFromIssue(ctx context.Context, issueID, label, actor string) error

RemoveLabelFromIssue removes a label from an issue.

func (*Store) ReopenIssue

func (s *Store) ReopenIssue(ctx context.Context, id string, actor string) error

ReopenIssue reopens a closed issue.

func (*Store) UpdateComment

func (s *Store) UpdateComment(ctx context.Context, commentID int64, text string) error

UpdateComment updates a comment's text.

func (*Store) UpdateIssue

func (s *Store) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error

UpdateIssue updates an issue with the given updates.

func (*Store) UpdateLabel

func (s *Store) UpdateLabel(ctx context.Context, label *types.Label) error

UpdateLabel updates a label.

func (*Store) UpdateWorkspace

func (s *Store) UpdateWorkspace(ctx context.Context, ws *types.Workspace) error

UpdateWorkspace updates a workspace.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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