store

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package store provides SQLite-backed persistence for workflow run data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the default database path (~/.cache/ci-snitch/data.db).

Types

type Store

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

Store persists and queries workflow run data in SQLite.

func Open

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

Open opens or creates a SQLite database at the given path.

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) IncompleteRunIDs

func (s *Store) IncompleteRunIDs() ([]int64, error)

IncompleteRunIDs returns IDs of runs that are not yet completed.

func (*Store) LoadRunDetail

func (s *Store) LoadRunDetail(runID int64) (*model.RunDetail, error)

LoadRunDetail loads a fully hydrated run detail from the store.

func (*Store) LoadRunDetails

func (s *Store) LoadRunDetails(workflowID int64, since time.Time) ([]model.RunDetail, error)

LoadRunDetails loads all completed run details for a workflow since the given time.

func (*Store) RunsSince

func (s *Store) RunsSince(workflowID int64, since time.Time) ([]model.WorkflowRun, error)

RunsSince returns completed runs for a workflow since the given time.

func (*Store) SaveRunDetail

func (s *Store) SaveRunDetail(d *model.RunDetail) error

SaveRunDetail persists a run and its jobs and steps. Uses INSERT OR REPLACE so re-fetched runs (e.g. previously in-progress) are updated.

func (*Store) SaveRunDetails

func (s *Store) SaveRunDetails(details []model.RunDetail) error

SaveRunDetails persists multiple run details in a single transaction with prepared statements for efficiency.

Jump to

Keyboard shortcuts

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