Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const LatestVersion int64 = 2

LatestVersion is the highest schema version shipped in this binary.

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.

func IsPostgres added in v0.2.0

func IsPostgres(target string) bool

IsPostgres recognizes both PostgreSQL URL schemes. All other targets retain their existing SQLite filename/URI semantics.

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
	// contains filtered or unexported fields
}

func Connect added in v0.2.0

func Connect(ctx context.Context, target string) (*Store, error)

Connect opens a database without applying migrations, for migration commands.

func Open

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

Open preserves automatic schema upgrades for existing callers.

func OpenContext added in v0.2.0

func OpenContext(ctx context.Context, target 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) Migrate added in v0.2.0

func (s *Store) Migrate(ctx context.Context, direction string, target *int64) (int64, error)

Migrate uses the same version history for automatic upgrades and explicit operations. A nil target means all pending upgrades or one downgrade.

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