Documentation
¶
Index ¶
- type FeedId
- type FeedItemId
- type FeedItemRecord
- type FeedRecord
- type FeedStore
- func (s *FeedStore) Close()
- func (s *FeedStore) DeleteFeed(feedId FeedId) error
- func (s *FeedStore) GetOrCreateFeedWithUrl(url string) (FeedId, error)
- func (s *FeedStore) Initialize() error
- func (s *FeedStore) RetrieveFeed(id FeedId) (FeedRecord, error)
- func (s *FeedStore) RetrieveFeedItems(feedId FeedId) ([]FeedItemRecord, error)
- func (s *FeedStore) RetrieveFeedSyncStatus(id FeedId) (bool, FeedSyncStatus, error)
- func (s *FeedStore) RetrieveFeeds() ([]FeedRecord, error)
- func (s *FeedStore) SetFeedSyncStatusError(id FeedId, syncErr error) error
- func (s *FeedStore) SyncFeed(id FeedId, feed feed.Feed) error
- type FeedSyncStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FeedItemId ¶
type FeedItemId int64
FeedItemId is a unique identifier for each feed item stored in the database
type FeedItemRecord ¶
type FeedItemRecord struct { Id FeedItemId // Title of the item (retrieved) Title string // Date the item was published Date time.Time // Url of the item Url string // Globally unique identifier for the item, retrieved // from the feed source. Guid string }
FeedItemRecord is the data associated with a feed item in the database
type FeedRecord ¶
type FeedRecord struct { Id FeedId // Url for the feed, must be unique Url string // Name of the feed Name string }
FeedRecord is the data associated with a feed in the database
type FeedStore ¶
type FeedStore struct {
// contains filtered or unexported fields
}
FeedStore provides thread-safe CRUD operations for feeds and feed items
func NewFeedStore ¶
NewFeedStore configures a feed store instance. This does NOT open a database connection. See the SQLite driver documentation for the `dbPath` format
func (*FeedStore) Close ¶
func (s *FeedStore) Close()
Close gracefully shuts down the database This must be called before the application exits
func (*FeedStore) DeleteFeed ¶
DeleteFeed transactionally deletes the specified feed and all its items
func (*FeedStore) GetOrCreateFeedWithUrl ¶
InsertFeedWithUrl creates a feed record for the specified URL This is a placeholder with no feed items, meant to be updated once the feed is loaded from an external source (e.g. RSS XML)
func (*FeedStore) Initialize ¶
Initialize opens the database and (if necessary) creates tables, indices, and prepared statements.
func (*FeedStore) RetrieveFeed ¶
func (s *FeedStore) RetrieveFeed(id FeedId) (FeedRecord, error)
RetrieveFeed retrieves a single feed record by its id.
func (*FeedStore) RetrieveFeedItems ¶
func (s *FeedStore) RetrieveFeedItems(feedId FeedId) ([]FeedItemRecord, error)
RetrieveFeedItems retrieves a record for every feed item for a given feed
func (*FeedStore) RetrieveFeedSyncStatus ¶
func (s *FeedStore) RetrieveFeedSyncStatus(id FeedId) (bool, FeedSyncStatus, error)
RetrieveFeedSyncStatus retrieves the status of the most recently completed sync attempt If no attempt has yet completed because the feed was just added, then the first return value will be false.
func (*FeedStore) RetrieveFeeds ¶
func (s *FeedStore) RetrieveFeeds() ([]FeedRecord, error)
RetrieveFeeds retrieves a record for every feed in the database
func (*FeedStore) SetFeedSyncStatusError ¶
SetFeedSyncStatusError sets the most recent sync attempt to "error" status
type FeedSyncStatus ¶
type FeedSyncStatus struct { // The datetime of the last sync attempt Date time.Time // Whether the last sync attempt was successful Success bool // The error, if any, that occurred during the sync // This isn't displayed in the UI, but we store it anyway // for debugging purposes. Error error }
FeedSyncStatus represents the most recent attempt to synchronize the feed with its external source.