Documentation ¶
Index ¶
- func StartGC(ctx context.Context, d *Database)
- type Database
- func (d *Database) Close() error
- func (d *Database) DeleteArticlesByIdForUser(u models.User, ids []int64) error
- func (d *Database) DeleteArticlesForUser(u models.User, minTimestamp time.Time) (int64, error)
- func (d *Database) DeleteFeedForUser(u models.User, feedId int64, folderId int64) error
- func (d *Database) GetAllFaviconsForUser(u models.User) (map[int64]string, error)
- func (d *Database) GetAllFeedsForUser(u models.User) ([]models.Feed, error)
- func (d *Database) GetAllFoldersForUser(u models.User) ([]models.Folder, error)
- func (d *Database) GetAllRetrievalCaches() (map[string]string, error)
- func (d *Database) GetAllUsers() ([]models.User, error)
- func (d *Database) GetArticlesForFeedForUser(u models.User, feedId int64) ([]models.Article, error)
- func (d *Database) GetArticlesForUser(u models.User, ids []int64) ([]models.Article, error)
- func (d *Database) GetFeedsInFolderForUser(u models.User, folderId int64) ([]models.Feed, error)
- func (d *Database) GetFeedsPerFolderForUser(u models.User) (map[int64][]int64, error)
- func (d *Database) GetFolderChildrenForUser(u models.User, id int64) ([]int64, error)
- func (d *Database) GetFolderFeedTreeForUser(u models.User) (*models.Folder, error)
- func (d *Database) GetUnreadArticleMetaForUser(u models.User, limit int, sinceID int64) ([]models.Article, error)
- func (d *Database) GetUnreadArticlesForUser(u models.User, limit int, sinceID int64) ([]models.Article, error)
- func (d *Database) GetUserByKey(key string) (models.User, error)
- func (d *Database) GetUserByUsername(username string) (models.User, error)
- func (d *Database) ImportOpmlForUser(u models.User, opml *opml.Opml) error
- func (d *Database) InsertArticleForUser(u models.User, a models.Article) error
- func (d *Database) InsertFaviconForUser(u models.User, folderId int64, feedId int64, mime string, img []byte) error
- func (d *Database) InsertFeedForUser(u models.User, f models.Feed, folderId int64) (int64, error)
- func (d *Database) InsertFolderForUser(u models.User, f models.Folder, parentId int64) (int64, error)
- func (d *Database) InsertUser(u models.User) error
- func (d *Database) MarkArticleForUser(u models.User, articleId int64, status string) error
- func (d *Database) MarkFeedForUser(u models.User, feedId int64, status string) error
- func (d *Database) MarkFolderForUser(u models.User, folderId int64, status string) error
- func (d *Database) PersistAllRetrievalCaches(entries map[string][]byte) error
- func (d *Database) UpdateFeedMetadataForUser(u models.User, f models.Feed) error
- func (d *Database) UpdateFolderForFeedForUser(u models.User, feedId int64, folderId int64) error
- func (d *Database) UpdateLatestTimeForFeedForUser(u models.User, folderId int64, id int64, latest time.Time) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is a wrapper type around a database connection.
func (*Database) DeleteArticlesByIdForUser ¶
DeleteArticlesByIdForUser deletes articles in the given list of IDs for the given user.
func (*Database) DeleteArticlesForUser ¶
DeleteArticlesForUser deletes all articles earlier than the given timestamp and returns the number deleted.
func (*Database) DeleteFeedForUser ¶
DeleteFeedForUser deletes the specified feed and all articles under that feed.
func (*Database) GetAllFaviconsForUser ¶
GetAllFaviconsForUser returns a map of feed ID to a base64 representation of its favicon. Feeds with no favicons are not part of the returned map.
func (*Database) GetAllFeedsForUser ¶
GetAllFeedsForUser returns a list of all feeds in the database for the given user.
func (*Database) GetAllFoldersForUser ¶
GetAllFoldersForUser returns a list of all folders in the database for the given user.
func (*Database) GetAllRetrievalCaches ¶
GetAllRetrievalCaches retrieves the cache for all users.
func (*Database) GetAllUsers ¶
GetAllUsers returns a list of all models.User objects.
func (*Database) GetArticlesForFeedForUser ¶
GetArticlesForFeedForUser returns a list of articles for the given feed ID and user.
func (*Database) GetArticlesForUser ¶
GetArticlesForUser returns articles from the specified list.
func (*Database) GetFeedsInFolderForUser ¶
GetFeedsInFolderForUser returns a list of feeds directly under the given folder for the given user.
func (*Database) GetFeedsPerFolderForUser ¶
GetFeedsPerFolderForUser returns a map of folder ID to an array of feed IDs.
func (*Database) GetFolderChildrenForUser ¶
GetFolderChildrenForUser returns a list of IDs corresponding to folders under the given folder ID.
func (*Database) GetFolderFeedTreeForUser ¶
GetFolderFeedTreeForUser returns a root Folder object with associated feeds and recursively populated sub-folders.
func (*Database) GetUnreadArticleMetaForUser ¶
func (d *Database) GetUnreadArticleMetaForUser(u models.User, limit int, sinceID int64) ([]models.Article, error)
GetUnreadArticleMetaForUser returns a list of at most the given limit of articles after the given ID. Only metadata fields are returned, not content.
func (*Database) GetUnreadArticlesForUser ¶
func (d *Database) GetUnreadArticlesForUser(u models.User, limit int, sinceID int64) ([]models.Article, error)
GetUnreadArticlesForUser returns a list of at most the given limit of articles after the given ID.
func (*Database) GetUserByKey ¶
GetUserByKey returns a user identified by the given key.
func (*Database) GetUserByUsername ¶
GetUserByUsername returns a user identified by the given username.
func (*Database) ImportOpmlForUser ¶
ImportOpmlForUser inserts folders from the given OPML object into the database for the given user.
func (*Database) InsertArticleForUser ¶
InsertArticleForUser inserts the given article object into the database.
func (*Database) InsertFaviconForUser ¶
func (d *Database) InsertFaviconForUser(u models.User, folderId int64, feedId int64, mime string, img []byte) error
InsertFaviconForUser inserts the given favicon and associated metadata into the database.
func (*Database) InsertFeedForUser ¶
InsertFeedForUser inserts a new feed into the database. If `folderId` is 0, the feed is assumed to be a top-level entry. Otherwise, the feed will be nested under the folder with that ID.
func (*Database) InsertFolderForUser ¶
func (d *Database) InsertFolderForUser(u models.User, f models.Folder, parentId int64) (int64, error)
InsertFolderForUser inserts a new folder into the database. If `parentId` is 0, the folder is assumed to be the root folder. Otherwise, the folder will be nested under the folder with that ID.
func (*Database) InsertUser ¶
InsertUser inserts the given user into the database.
func (*Database) MarkArticleForUser ¶
MarkArticleForUser sets the read status of the given article to the given status.
func (*Database) MarkFeedForUser ¶
MarkFeedForUser sets the read status of all articles in the given feed to the given status.
func (*Database) MarkFolderForUser ¶
MarkFolderForUser sets the read status of all articles in the given folder to the given status. An ID of 0 will mark all articles in all folders to the given status.
func (*Database) PersistAllRetrievalCaches ¶
PersistAllRetrievalCaches writes the retrieval caches for all users.
func (*Database) UpdateFeedMetadataForUser ¶
UpdateFeedMetadataForUser updates various fields for the row corresponding to given models.Feed object with the values in that object.
func (*Database) UpdateFolderForFeedForUser ¶
UpdateFolderForFeedForUser updates the folder of the given feed. The new `folderId` must already exist and is enforced by a foreign key constraint on the `Feed` folder.