Documentation
¶
Index ¶
- type ClassificationRepo
- type ConfigProvider
- type Database
- type FeedRepo
- type ItemRepo
- type RepositoryAdapter
- func (r *RepositoryAdapter) CreateFeed(ctx context.Context, feed *domain.Feed) error
- func (r *RepositoryAdapter) DeleteFeed(ctx context.Context, feedID int64) error
- func (r *RepositoryAdapter) GetActiveFeedNames(ctx context.Context, minScore float64) ([]string, error)
- func (r *RepositoryAdapter) GetAllFeeds(ctx context.Context) ([]domain.Feed, error)
- func (r *RepositoryAdapter) GetClassifiedItem(ctx context.Context, itemID int64) (*domain.ClassifiedItem, error)
- func (r *RepositoryAdapter) GetClassifiedItems(ctx context.Context, minScore float64, topic string, limit int) ([]domain.ClassifiedItem, error)
- func (r *RepositoryAdapter) GetClassifiedItemsCount(ctx context.Context, req domain.ArticlesRequest) (int, error)
- func (r *RepositoryAdapter) GetClassifiedItemsWithFilters(ctx context.Context, req domain.ArticlesRequest) ([]domain.ClassifiedItem, error)
- func (r *RepositoryAdapter) GetFeedbackCount(ctx context.Context) (int64, error)
- func (r *RepositoryAdapter) GetFeeds(ctx context.Context) ([]domain.Feed, error)
- func (r *RepositoryAdapter) GetItems(ctx context.Context, limit, _ int) ([]domain.Item, error)
- func (r *RepositoryAdapter) GetSearchItemsCount(ctx context.Context, searchQuery string, req domain.ArticlesRequest) (int, error)
- func (r *RepositoryAdapter) GetSetting(ctx context.Context, key string) (string, error)
- func (r *RepositoryAdapter) GetTopTopicsByScore(ctx context.Context, minScore float64, limit int) ([]domain.TopicWithScore, error)
- func (r *RepositoryAdapter) GetTopics(ctx context.Context) ([]string, error)
- func (r *RepositoryAdapter) GetTopicsFiltered(ctx context.Context, minScore float64) ([]string, error)
- func (r *RepositoryAdapter) SearchItems(ctx context.Context, searchQuery string, req domain.ArticlesRequest) ([]domain.ClassifiedItem, error)
- func (r *RepositoryAdapter) SetSetting(ctx context.Context, key, value string) error
- func (r *RepositoryAdapter) UpdateFeed(ctx context.Context, feedID int64, title string, fetchInterval time.Duration) error
- func (r *RepositoryAdapter) UpdateFeedStatus(ctx context.Context, feedID int64, enabled bool) error
- func (r *RepositoryAdapter) UpdateItemFeedback(ctx context.Context, itemID int64, feedback string) error
- type Scheduler
- type Server
- type SettingRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClassificationRepo ¶
type ClassificationRepo interface {
GetClassifiedItems(ctx context.Context, filter *domain.ItemFilter) ([]*domain.ClassifiedItem, error)
GetClassifiedItemsCount(ctx context.Context, filter *domain.ItemFilter) (int, error)
GetClassifiedItem(ctx context.Context, itemID int64) (*domain.ClassifiedItem, error)
UpdateItemFeedback(ctx context.Context, itemID int64, feedback *domain.Feedback) error
GetTopics(ctx context.Context) ([]string, error)
GetTopicsFiltered(ctx context.Context, minScore float64) ([]string, error)
GetTopTopicsByScore(ctx context.Context, minScore float64, limit int) ([]repository.TopicWithScore, error)
GetFeedbackCount(ctx context.Context) (int64, error)
SearchItems(ctx context.Context, searchQuery string, filter *domain.ItemFilter) ([]*domain.ClassifiedItem, error)
GetSearchItemsCount(ctx context.Context, searchQuery string, filter *domain.ItemFilter) (int, error)
}
ClassificationRepo defines the classification repository interface used by the adapter
type ConfigProvider ¶
type ConfigProvider interface {
GetServerConfig() (listen string, timeout time.Duration)
GetFullConfig() *config.Config // returns the full config struct for display
}
ConfigProvider provides server configuration
type Database ¶
type Database interface {
GetFeeds(ctx context.Context) ([]domain.Feed, error)
GetItems(ctx context.Context, limit, offset int) ([]domain.Item, error)
GetClassifiedItems(ctx context.Context, minScore float64, topic string, limit int) ([]domain.ClassifiedItem, error)
GetClassifiedItemsWithFilters(ctx context.Context, req domain.ArticlesRequest) ([]domain.ClassifiedItem, error)
GetClassifiedItemsCount(ctx context.Context, req domain.ArticlesRequest) (int, error)
GetClassifiedItem(ctx context.Context, itemID int64) (*domain.ClassifiedItem, error)
UpdateItemFeedback(ctx context.Context, itemID int64, feedback string) error
GetTopics(ctx context.Context) ([]string, error)
GetTopicsFiltered(ctx context.Context, minScore float64) ([]string, error)
GetTopTopicsByScore(ctx context.Context, minScore float64, limit int) ([]domain.TopicWithScore, error)
GetActiveFeedNames(ctx context.Context, minScore float64) ([]string, error)
GetAllFeeds(ctx context.Context) ([]domain.Feed, error)
CreateFeed(ctx context.Context, feed *domain.Feed) error
UpdateFeed(ctx context.Context, feedID int64, title string, fetchInterval time.Duration) error
UpdateFeedStatus(ctx context.Context, feedID int64, enabled bool) error
DeleteFeed(ctx context.Context, feedID int64) error
GetSetting(ctx context.Context, key string) (string, error)
SetSetting(ctx context.Context, key, value string) error
SearchItems(ctx context.Context, searchQuery string, req domain.ArticlesRequest) ([]domain.ClassifiedItem, error)
GetSearchItemsCount(ctx context.Context, searchQuery string, req domain.ArticlesRequest) (int, error)
}
Database interface for server operations
type FeedRepo ¶
type FeedRepo interface {
GetFeeds(ctx context.Context, enabledOnly bool) ([]domain.Feed, error)
CreateFeed(ctx context.Context, feed *domain.Feed) error
UpdateFeed(ctx context.Context, feedID int64, title string, fetchInterval time.Duration) error
UpdateFeedStatus(ctx context.Context, feedID int64, enabled bool) error
DeleteFeed(ctx context.Context, feedID int64) error
GetActiveFeedNames(ctx context.Context, minScore float64) ([]string, error)
}
FeedRepo defines the feed repository interface used by the adapter
type ItemRepo ¶
type ItemRepo interface {
GetItems(ctx context.Context, limit int, minScore float64) ([]domain.Item, error)
}
ItemRepo defines the item repository interface used by the adapter
type RepositoryAdapter ¶
type RepositoryAdapter struct {
// contains filtered or unexported fields
}
RepositoryAdapter adapts repositories to server.Database interface
func NewRepositoryAdapter ¶
func NewRepositoryAdapter(repos *repository.Repositories) *RepositoryAdapter
NewRepositoryAdapter creates a new repository adapter from concrete repositories
func NewRepositoryAdapterWithInterfaces ¶
func NewRepositoryAdapterWithInterfaces(feedRepo FeedRepo, itemRepo ItemRepo, classificationRepo ClassificationRepo, settingRepo SettingRepo) *RepositoryAdapter
NewRepositoryAdapterWithInterfaces creates a new repository adapter with interface dependencies for testing
func (*RepositoryAdapter) CreateFeed ¶
CreateFeed adds a new feed
func (*RepositoryAdapter) DeleteFeed ¶
func (r *RepositoryAdapter) DeleteFeed(ctx context.Context, feedID int64) error
DeleteFeed removes a feed
func (*RepositoryAdapter) GetActiveFeedNames ¶
func (r *RepositoryAdapter) GetActiveFeedNames(ctx context.Context, minScore float64) ([]string, error)
GetActiveFeedNames returns names of feeds that have classified articles
func (*RepositoryAdapter) GetAllFeeds ¶
GetAllFeeds returns all feeds with full details
func (*RepositoryAdapter) GetClassifiedItem ¶
func (r *RepositoryAdapter) GetClassifiedItem(ctx context.Context, itemID int64) (*domain.ClassifiedItem, error)
GetClassifiedItem returns a single item with classification data
func (*RepositoryAdapter) GetClassifiedItems ¶
func (r *RepositoryAdapter) GetClassifiedItems(ctx context.Context, minScore float64, topic string, limit int) ([]domain.ClassifiedItem, error)
GetClassifiedItems returns items with classification data
func (*RepositoryAdapter) GetClassifiedItemsCount ¶
func (r *RepositoryAdapter) GetClassifiedItemsCount(ctx context.Context, req domain.ArticlesRequest) (int, error)
GetClassifiedItemsCount returns total count of classified items matching filters
func (*RepositoryAdapter) GetClassifiedItemsWithFilters ¶
func (r *RepositoryAdapter) GetClassifiedItemsWithFilters(ctx context.Context, req domain.ArticlesRequest) ([]domain.ClassifiedItem, error)
GetClassifiedItemsWithFilters returns items with classification data filtered by topic and feed
func (*RepositoryAdapter) GetFeedbackCount ¶
func (r *RepositoryAdapter) GetFeedbackCount(ctx context.Context) (int64, error)
GetFeedbackCount returns the total number of feedback items
func (*RepositoryAdapter) GetSearchItemsCount ¶
func (r *RepositoryAdapter) GetSearchItemsCount(ctx context.Context, searchQuery string, req domain.ArticlesRequest) (int, error)
GetSearchItemsCount returns the total count of items matching the search query
func (*RepositoryAdapter) GetSetting ¶
GetSetting retrieves a setting value by key
func (*RepositoryAdapter) GetTopTopicsByScore ¶
func (r *RepositoryAdapter) GetTopTopicsByScore(ctx context.Context, minScore float64, limit int) ([]domain.TopicWithScore, error)
GetTopTopicsByScore returns topics ordered by average relevance score
func (*RepositoryAdapter) GetTopics ¶
func (r *RepositoryAdapter) GetTopics(ctx context.Context) ([]string, error)
GetTopics returns all unique topics from classified items
func (*RepositoryAdapter) GetTopicsFiltered ¶
func (r *RepositoryAdapter) GetTopicsFiltered(ctx context.Context, minScore float64) ([]string, error)
GetTopicsFiltered returns unique topics from items with score >= minScore
func (*RepositoryAdapter) SearchItems ¶
func (r *RepositoryAdapter) SearchItems(ctx context.Context, searchQuery string, req domain.ArticlesRequest) ([]domain.ClassifiedItem, error)
SearchItems searches for items using full-text search
func (*RepositoryAdapter) SetSetting ¶
func (r *RepositoryAdapter) SetSetting(ctx context.Context, key, value string) error
SetSetting stores a setting value
func (*RepositoryAdapter) UpdateFeed ¶
func (r *RepositoryAdapter) UpdateFeed(ctx context.Context, feedID int64, title string, fetchInterval time.Duration) error
UpdateFeed updates feed title and interval
func (*RepositoryAdapter) UpdateFeedStatus ¶
UpdateFeedStatus enables or disables a feed
func (*RepositoryAdapter) UpdateItemFeedback ¶
func (r *RepositoryAdapter) UpdateItemFeedback(ctx context.Context, itemID int64, feedback string) error
UpdateItemFeedback updates user feedback for an item
type Scheduler ¶
type Scheduler interface {
UpdateFeedNow(ctx context.Context, feedID int64) error
ExtractContentNow(ctx context.Context, itemID int64) error
UpdatePreferenceSummary(ctx context.Context) error
TriggerPreferenceUpdate()
}
Scheduler interface for on-demand operations
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents HTTP server instance
func New ¶
func New(cfg ConfigProvider, database Database, scheduler Scheduler, version string, debug bool) *Server
New initializes a new server instance
func (*Server) GetPageSize ¶
GetPageSize returns the configured page size for pagination