store

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

Types

type GormStore

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

GormStore implements the Store interface using GORM

var (
	Db *GormStore
)

func New

func New(path string) (*GormStore, error)

New creates a new GormStore instance

func (*GormStore) Close

func (s *GormStore) Close() error

Close closes the database connection by getting the underlying SQL DB instance

func (*GormStore) DeleteFeed

func (s *GormStore) DeleteFeed(id string) error

func (*GormStore) DeleteFeedArticles

func (s *GormStore) DeleteFeedArticles(feedId string) error

func (*GormStore) DeleteFeedGroup

func (s *GormStore) DeleteFeedGroup(id string) error

DeleteFeedGroup deletes a feed group

func (*GormStore) FindDigestsWithSameArticleSet

func (s *GormStore) FindDigestsWithSameArticleSet(digestId string) ([]models.Digest, error)

FindDigestsWithSameArticleSet returns all digests (including digestId itself) whose digest_articles set is exactly equal to digestId's set, ordered by created_at DESC. ProviderResults are populated so callers can label each sibling by its provider/model.

func (*GormStore) GetAllArticleAnalyses

func (s *GormStore) GetAllArticleAnalyses(articleId string) ([]models.ArticleAnalysis, error)

func (*GormStore) GetArticle

func (s *GormStore) GetArticle(id string) (models.Article, error)

func (*GormStore) GetArticleAnalysesBatch

func (s *GormStore) GetArticleAnalysesBatch(articleIds []string) (map[string]*models.ArticleAnalysis, error)

GetArticleAnalysesBatch returns the most recent analysis for each of the given article IDs.

func (*GormStore) GetArticleAnalysis

func (s *GormStore) GetArticleAnalysis(articleId string) (*models.ArticleAnalysis, error)

func (*GormStore) GetArticleCounts

func (s *GormStore) GetArticleCounts(filter models.ArticleFilter) (models.ArticleCounts, error)

func (*GormStore) GetArticlesBatch

func (s *GormStore) GetArticlesBatch(ids []string) ([]models.Article, error)

func (*GormStore) GetCategories

func (s *GormStore) GetCategories() ([]models.Category, error)

func (*GormStore) GetDigest

func (s *GormStore) GetDigest(id string) (models.Digest, error)

func (*GormStore) GetDigestAnalyses

func (s *GormStore) GetDigestAnalyses(digestId string) ([]models.DigestAnalysis, error)

func (*GormStore) GetDigestArticles

func (s *GormStore) GetDigestArticles(digestId string) ([]models.Article, error)

func (*GormStore) GetDigestProviderResult

func (s *GormStore) GetDigestProviderResult(id string) (models.DigestProviderResult, error)

func (*GormStore) GetDigestProviderResults

func (s *GormStore) GetDigestProviderResults(digestId string) ([]models.DigestProviderResult, error)

func (*GormStore) GetFeed

func (s *GormStore) GetFeed(id string) (models.Feed, error)

func (*GormStore) GetFeedGroup

func (s *GormStore) GetFeedGroup(id string) (models.FeedGroup, error)

GetFeedGroup returns a feed group by Id

func (*GormStore) GetOrCreateCategory

func (s *GormStore) GetOrCreateCategory(name string) (*models.Category, error)

GetOrCreateCategory returns a category with the given name, creating it if it doesn't exist.

func (*GormStore) ListArticles

func (s *GormStore) ListArticles(filter models.ArticleFilter) ([]models.Article, error)

func (*GormStore) ListDigests

func (s *GormStore) ListDigests(limit int, full bool) ([]models.Digest, error)

func (*GormStore) ListFeedGroups

func (s *GormStore) ListFeedGroups() ([]models.FeedGroup, error)

ListFeedGroups returns all feed groups

func (*GormStore) ListFeeds

func (s *GormStore) ListFeeds() ([]models.Feed, error)

func (*GormStore) MarkFeedArticlesAsRead

func (s *GormStore) MarkFeedArticlesAsRead(feedId string) error

func (*GormStore) SaveArticleAnalysis

func (s *GormStore) SaveArticleAnalysis(analysis *models.ArticleAnalysis) error

func (*GormStore) SaveCategory

func (s *GormStore) SaveCategory(category models.Category) error

func (*GormStore) StoreArticle

func (s *GormStore) StoreArticle(article models.Article) error

func (*GormStore) StoreDigest

func (s *GormStore) StoreDigest(digest models.Digest) error

func (*GormStore) StoreDigestAnalysesBatch

func (s *GormStore) StoreDigestAnalysesBatch(entries []models.DigestAnalysis) error

func (*GormStore) StoreDigestAnalysis

func (s *GormStore) StoreDigestAnalysis(entry models.DigestAnalysis) error

func (*GormStore) StoreDigestArticle

func (s *GormStore) StoreDigestArticle(digestId string, articleId string) error

func (*GormStore) StoreDigestArticlesBatch

func (s *GormStore) StoreDigestArticlesBatch(digestId string, articleIds []string) error

StoreDigestArticlesBatch associates a batch of articles with a digest in a single operation.

func (*GormStore) StoreDigestProviderResult

func (s *GormStore) StoreDigestProviderResult(result models.DigestProviderResult) error

func (*GormStore) StoreFeed

func (s *GormStore) StoreFeed(feed models.Feed) error

func (*GormStore) StoreFeedGroup

func (s *GormStore) StoreFeedGroup(group models.FeedGroup) error

StoreFeedGroup stores a feed group

func (*GormStore) UpdateArticle

func (s *GormStore) UpdateArticle(id string, update models.ArticleUpdate) error

func (*GormStore) UpdateFeedLastFetch

func (s *GormStore) UpdateFeedLastFetch(id string, lastFetch time.Time) error

type Store

type Store interface {
	Close() error

	StoreFeed(feed models.Feed) error
	GetFeed(id string) (models.Feed, error)
	ListFeeds() ([]models.Feed, error)
	UpdateFeedLastFetch(id string, lastFetch time.Time) error
	DeleteFeed(id string) error // Method for deleting a feed

	StoreArticle(article models.Article) error
	GetArticle(id string) (models.Article, error)
	GetArticlesBatch(ids []string) ([]models.Article, error)
	ListArticles(filter models.ArticleFilter) ([]models.Article, error)
	GetArticleCounts(filter models.ArticleFilter) (models.ArticleCounts, error)
	UpdateArticle(id string, update models.ArticleUpdate) error
	MarkFeedArticlesAsRead(feedId string) error
	DeleteFeedArticles(feedId string) error

	StoreDigest(digest models.Digest) error
	GetDigest(id string) (models.Digest, error)
	ListDigests(limit int, full bool) ([]models.Digest, error)
	StoreDigestArticle(digestId string, articleId string) error
	StoreDigestArticlesBatch(digestId string, articleIds []string) error
	GetDigestArticles(digestId string) ([]models.Article, error)
	FindDigestsWithSameArticleSet(digestId string) ([]models.Digest, error)

	StoreDigestProviderResult(result models.DigestProviderResult) error
	GetDigestProviderResults(digestId string) ([]models.DigestProviderResult, error)
	GetDigestProviderResult(id string) (models.DigestProviderResult, error)

	StoreDigestAnalysis(entry models.DigestAnalysis) error
	StoreDigestAnalysesBatch(entries []models.DigestAnalysis) error
	GetDigestAnalyses(digestId string) ([]models.DigestAnalysis, error)

	GetCategories() ([]models.Category, error)
	SaveCategory(category models.Category) error
	GetOrCreateCategory(name string) (*models.Category, error)

	SaveArticleAnalysis(analysis *models.ArticleAnalysis) error
	GetArticleAnalysis(articleId string) (*models.ArticleAnalysis, error)
	GetArticleAnalysesBatch(articleIds []string) (map[string]*models.ArticleAnalysis, error)
	GetAllArticleAnalyses(articleId string) ([]models.ArticleAnalysis, error)

	ListFeedGroups() ([]models.FeedGroup, error)
	GetFeedGroup(id string) (models.FeedGroup, error)
	StoreFeedGroup(group models.FeedGroup) error
	DeleteFeedGroup(id string) error
}

Jump to

Keyboard shortcuts

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