Documentation
¶
Index ¶
- Variables
- func CreateFeed(f Feed) error
- func CreateItem(i Item) error
- func DeleteFeed(f Feed) error
- func DeleteFeedById(id uint) error
- func FeedExists(s string) bool
- func RecentBreakingNews() ([]string, bool)
- func SaveFeed(f Feed) error
- func SaveItem(i Item) error
- func UpdateFeeds() error
- type Configuration
- type Feed
- type Item
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Config = Configuration{} ErrNoDBConnection = errors.New("no database connection") ErrNotInCache = errors.New("no item in cache for this path") )
Functions ¶
func CreateFeed ¶
func CreateItem ¶
func DeleteFeed ¶
func DeleteFeedById ¶
func FeedExists ¶
func RecentBreakingNews ¶
Returns the last 10 headlines scored 85 or higher
func UpdateFeeds ¶
func UpdateFeeds() error
LoadFeedsIntoDB loads the feed list from the DB, then calls ingestFromUrlWriteToDB (concurrently) to load all feed items and write them to the DB (skipping duplicates).
Types ¶
type Configuration ¶
func (*Configuration) OpenDatabase ¶
func (c *Configuration) OpenDatabase(path string) error
func (*Configuration) SetTickerChannel ¶
func (c *Configuration) SetTickerChannel(ch chan Item)
type Item ¶
type Item struct {
ID uint `gorm:"primaryKey"`
CreatedAt time.Time
UpdatedAt time.Time
Title string
FeedAbbr string
Link string
Description string
Content string
Hash string `gorm:"uniqueIndex"`
BreakingNewsScore int
BreakingNewsReason string
PublishedParsed *time.Time `gorm:"index"`
}
The Item struct stores an item from an RSS feed.
func FirstUnscoredHeadline ¶
func UnscoredHeadlines ¶
Click to show internal directories.
Click to hide internal directories.