store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnrichStatusOK       = "ok"
	EnrichStatusNotFound = "not_found"
)

Variables

View Source
var ErrDuplicate = errors.New("store: article already exists")

Functions

This section is empty.

Types

type AINote

type AINote struct {
	ID         int64
	ClusterID  int64
	Provider   string
	Summary    string
	Why        string
	AnglesJSON string
	Format     string
	CreatedAt  int64
}

type Article

type Article struct {
	SourceID     int64
	CanonicalURL string
	ContentHash  string
	TitleHash    string
	Title        string
	Summary      string
	Body         string
	Author       string
	PublishedAt  int64
	FetchedAt    int64
}

type ArticleSummary

type ArticleSummary struct {
	ID           int64
	SourceName   string
	Title        string
	CanonicalURL string
	PublishedAt  int64
}

type CVE

type CVE struct {
	ID             string
	Description    string
	CVSSScore      *float64
	CVSSVersion    string
	CVSSSeverity   string
	CVSSVector     string
	CWE            string
	IsKEV          bool
	KEVDateAdded   string
	KEVRansomware  bool
	EPSS           *float64
	EPSSPercentile *float64
	NVDPublished   string
	NVDModified    string
	EnrichedAt     int64
	EnrichStatus   string
}

type CandidateArticle

type CandidateArticle struct {
	ID       int64
	SourceID int64
	Title    string
	Time     int64
}

type ClusterRow

type ClusterRow struct {
	Key       string
	Members   []int64
	FirstSeen int64
	LastSeen  int64
}

type DigestArticle

type DigestArticle struct {
	ID           int64
	SourceName   string
	SourceWeight float64
	Title        string
	CanonicalURL string
	PublishedAt  int64
}

type DigestCVE

type DigestCVE struct {
	ID        string
	CVSSScore *float64
	EPSS      *float64
	IsKEV     bool
}

type DigestCluster

type DigestCluster struct {
	ClusterID int64
	Key       string
	Size      int
	FirstSeen int64
	LastSeen  int64
	Articles  []DigestArticle
	CVEs      []DigestCVE
}

type FetchState

type FetchState struct {
	ETag         string
	LastModified string
	LastFetched  int64
	LastStatus   int64
}

type ListFilter

type ListFilter struct {
	Source  string
	Since   int64
	MinCVSS float64
	KEV     bool
	Keyword string
	Limit   int
}

type SourceInput

type SourceInput struct {
	Name    string
	Title   string
	URL     string
	Type    string
	Weight  float64
	Tags    []string
	Enabled bool
}

type SourceRow

type SourceRow struct {
	ID      int64
	Name    string
	Title   string
	URL     string
	Type    string
	Weight  float64
	Tags    []string
	Enabled bool
}

type Store

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

func Open

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

func (*Store) AINoteExists

func (s *Store) AINoteExists(clusterID int64, provider string) (bool, error)

func (*Store) AINotesForCluster

func (s *Store) AINotesForCluster(clusterID int64) ([]AINote, error)

func (*Store) ArticleCVEMap

func (s *Store) ArticleCVEMap() (map[int64][]string, error)

func (*Store) ArticlesForCVE

func (s *Store) ArticlesForCVE(id string) ([]ArticleSummary, error)

func (*Store) CVEsNeedingEnrichment

func (s *Store) CVEsNeedingEnrichment(now, positiveTTL, negativeTTL int64) ([]string, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) ClusterCandidates

func (s *Store) ClusterCandidates(since int64) ([]CandidateArticle, error)

func (*Store) CountArticles

func (s *Store) CountArticles() (int, error)

func (*Store) DB

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

func (*Store) DigestClusters

func (s *Store) DigestClusters(since int64) ([]DigestCluster, error)

func (*Store) GetCVE

func (s *Store) GetCVE(id string) (CVE, error)

func (*Store) GetFetchState

func (s *Store) GetFetchState(sourceID int64) (FetchState, bool, error)

func (*Store) GetSourceByName

func (s *Store) GetSourceByName(name string) (SourceRow, error)

func (*Store) InsertAINote

func (s *Store) InsertAINote(n AINote) error

func (*Store) InsertArticle

func (s *Store) InsertArticle(a Article) (int64, error)

func (*Store) LatestAINotes

func (s *Store) LatestAINotes() (map[int64]AINote, error)

func (*Store) LinkArticleCVE

func (s *Store) LinkArticleCVE(articleID int64, cveID string) error

func (*Store) ListArticles

func (s *Store) ListArticles(f ListFilter) ([]ArticleSummary, error)

func (*Store) NewlyFetchedClusters

func (s *Store) NewlyFetchedClusters(sinceFetched int64) ([]DigestCluster, error)

func (*Store) ReplaceClusters

func (s *Store) ReplaceClusters(rows []ClusterRow) error

func (*Store) UpdateCVEEnrichment

func (s *Store) UpdateCVEEnrichment(c CVE) error

func (*Store) UpsertCVEStub

func (s *Store) UpsertCVEStub(id string) error

func (*Store) UpsertFetchState

func (s *Store) UpsertFetchState(sourceID int64, fs FetchState) error

func (*Store) UpsertSource

func (s *Store) UpsertSource(in SourceInput) (int64, error)

func (*Store) Version

func (s *Store) Version() int

Jump to

Keyboard shortcuts

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