store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPriority

func CanonicalPriority(value string) string

CanonicalPriority maps scanner-specific labels to the five labels shown by the application. Values that are not explicitly understood remain Unknown.

Types

type Alert

type Alert struct {
	ID, OrgID, RepositoryID, GitHubID                 int64
	Org, Repository, Tool, RuleID, RuleName, Severity string
	// Priority is the app's canonical priority. Severity is retained for
	// backwards-compatible callers and contains the scanner-reported value.
	Priority, ReportedSeverity, SeveritySource string
	RepositoryURL                              string
	RuleDescription, ToolVersion, ToolGUID     string
	Message, Ref, CommitSHA, AnalysisKey       string
	Environment, Category                      string
	Tags                                       []string
	Path                                       string
	StartLine, EndLine, StartColumn, EndColumn int
	URL                                        string
	CreatedAt, UpdatedAt                       time.Time
	Open                                       bool
}

type Organization

type Organization struct {
	ID         int64
	Login      string
	URL        string
	LastSync   *time.Time
	LastStatus string
}

type Repository

type Repository struct {
	ID                                                            int64
	OrgID                                                         int64
	GitHubID                                                      int64
	Owner, Name, FullName, URL, Description, Visibility, Language string
	Archived                                                      bool
	UpdatedAt                                                     time.Time
}

type Store

type Store struct{ DB *sql.DB }

func Open

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

func (*Store) BeginRun

func (s *Store) BeginRun(ctx context.Context, orgID int64) (int64, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) EnsureOrg

func (s *Store) EnsureOrg(ctx context.Context, login, url string, githubID int64) (int64, error)

func (*Store) FinishRun

func (s *Store) FinishRun(ctx context.Context, runID, orgID int64, status, message string, repoCount, alertCount int) error

func (*Store) OpenAlerts

func (s *Store) OpenAlerts(ctx context.Context) ([]Alert, error)

func (*Store) Organizations

func (s *Store) Organizations(ctx context.Context) ([]Organization, error)

func (*Store) ReplaceOpenAlerts

func (s *Store) ReplaceOpenAlerts(ctx context.Context, orgID int64, repoID *int64, alerts []Alert) error

func (*Store) ReplaceOpenAlertsWithProgress

func (s *Store) ReplaceOpenAlertsWithProgress(ctx context.Context, orgID int64, repoID *int64, alerts []Alert, progress func(done, total int)) error

ReplaceOpenAlertsWithProgress reports rows written inside the transaction. Completion of the callback does not imply the transaction has committed.

func (*Store) Repositories

func (s *Store) Repositories(ctx context.Context) ([]Repository, error)

func (*Store) RepositoryAlerts

func (s *Store) RepositoryAlerts(ctx context.Context, fullName string) ([]Alert, error)

RepositoryAlerts returns only the current cached open alerts for one repository.

func (*Store) UpsertRepository

func (s *Store) UpsertRepository(ctx context.Context, r Repository) (int64, error)

Jump to

Keyboard shortcuts

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