store

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package store opens metrics.sqlite, applies the DDL, and exposes prepared inserts for the canonical tables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store wraps a SQLite database and implements connector.Sink with prepared insert statements. Concurrent connector workers share one Store; per-call inserts are serialised behind a mutex so the single connection writer is safe.

func Open

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

Open opens (or creates) a SQLite database at path, applies the canonical DDL, records a _schema row capturing the schema and tool versions, and prepares one insert statement per Sink method.

func (*Store) Close

func (s *Store) Close() error

Close releases prepared statements and the underlying database handle.

func (*Store) DB

func (s *Store) DB() *sql.DB

DB exposes the underlying *sql.DB for cross-cutting passes (postprocess linkage) that need to issue UPDATEs against multiple tables. The store's mutex does not guard direct DB access; callers must coordinate with other writers, which in practice means using DB only after all connector extraction has finished.

func (*Store) InsertBranch

func (s *Store) InsertBranch(b model.Branch) error

func (*Store) InsertBranchProtection

func (s *Store) InsertBranchProtection(b model.BranchProtection) error

func (*Store) InsertBuild

func (s *Store) InsertBuild(b model.Build) error

func (*Store) InsertBuildJob

func (s *Store) InsertBuildJob(j model.BuildJob) error

func (*Store) InsertCodeowner

func (s *Store) InsertCodeowner(c model.Codeowner) error

func (*Store) InsertCommit

func (s *Store) InsertCommit(c model.Commit) error

func (*Store) InsertCommitCoauthor

func (s *Store) InsertCommitCoauthor(c model.CommitCoauthor) error

func (*Store) InsertCommitFile

func (s *Store) InsertCommitFile(c model.CommitFile) error

func (*Store) InsertDefect

func (s *Store) InsertDefect(d model.Defect) error

func (*Store) InsertDeploy

func (s *Store) InsertDeploy(d model.Deploy) error

func (*Store) InsertFileComplexityHistory

func (s *Store) InsertFileComplexityHistory(f model.FileComplexityHistory) error

func (*Store) InsertFileMetric

func (s *Store) InsertFileMetric(f model.FileMetric) error

func (*Store) InsertHarnessArtifact

func (s *Store) InsertHarnessArtifact(h model.HarnessArtifact) error

func (*Store) InsertIncident

func (s *Store) InsertIncident(i model.Incident) error

func (*Store) InsertPR

func (s *Store) InsertPR(p model.PR) error

func (*Store) InsertPRComment

func (s *Store) InsertPRComment(c model.PRComment) error

func (*Store) InsertPRCommit

func (s *Store) InsertPRCommit(p model.PRCommit) error

func (*Store) InsertPRLabel

func (s *Store) InsertPRLabel(l model.PRLabel) error

func (*Store) InsertPRReviewRequest

func (s *Store) InsertPRReviewRequest(r model.PRReviewRequest) error

func (*Store) InsertRelease

func (s *Store) InsertRelease(r model.Release) error

func (*Store) InsertRepo

func (s *Store) InsertRepo(r model.Repo) error

func (*Store) InsertRepoFile

func (s *Store) InsertRepoFile(f model.RepoFile) error

func (*Store) InsertRepoLanguage

func (s *Store) InsertRepoLanguage(r model.RepoLanguage) error

func (*Store) InsertReview

func (s *Store) InsertReview(r model.Review) error

func (*Store) InsertTeamRepo

func (s *Store) InsertTeamRepo(team, repo string) error

func (*Store) SquashStats

func (s *Store) SquashStats() (nSquash, nMerged int, err error)

SquashStats returns counts of merged PRs and squash-merged PRs across the entire artifact. Used by run.go after extraction to populate the manifest's `n_total_merged_prs` / `n_squash_merged_prs` / `squash_rate` fields; assay treats squash_rate > 0.5 as the Tornhill Ch 9 caveat threshold for coupling-derived metrics.

merge_method classification is per ADR 021 (parent count + PR-head reachability), already computed at extract time and stored in the prs.merge_method column — no re-derivation here.

Jump to

Keyboard shortcuts

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