Documentation ¶
Index ¶
- Constants
- Variables
- type Repository
- func (r Repository) FindArticleByID(id int) (*krautreporter.Article, error)
- func (r Repository) FindArticlesOlderThan(id int, number int) ([]*krautreporter.Article, error)
- func (r Repository) FindAuthorByID(id int) (*krautreporter.Author, error)
- func (r Repository) FindAuthors() ([]*krautreporter.Author, error)
- func (r Repository) FindOutdatedArticles() ([]*krautreporter.Article, error)
- func (r Repository) FindOutdatedAuthors() ([]*krautreporter.Author, error)
- func (r Repository) NextCrawls(limit int) ([]*krautreporter.Crawl, error)
- func (r Repository) SaveAllArticles(articles []*krautreporter.Article) error
- func (r Repository) SaveAllAuthors(authors []*krautreporter.Author) error
- func (r Repository) SaveArticle(article *krautreporter.Article) error
- func (r Repository) SaveAuthor(author *krautreporter.Author) error
Constants ¶
const MaxArticleID int = 1234567890
MaxArticleID is used for sorting descending
Variables ¶
var ErrArticleNotFound = errors.New("Article not found")
ErrArticleNotFound is returned if an article is not found by id
var ErrAuthorNotFound = errors.New("Author not found")
ErrAuthorNotFound is returned if an article is not found by id
Functions ¶
This section is empty.
Types ¶
type Repository ¶
Repository reads from the database or the cache if data is present
func (Repository) FindArticleByID ¶
func (r Repository) FindArticleByID(id int) (*krautreporter.Article, error)
FindArticleByID returns an Article for the ID matching the parameter
func (Repository) FindArticlesOlderThan ¶
func (r Repository) FindArticlesOlderThan(id int, number int) ([]*krautreporter.Article, error)
FindArticlesOlderThan returns a slice of Article that are older than an ID
func (Repository) FindAuthorByID ¶
func (r Repository) FindAuthorByID(id int) (*krautreporter.Author, error)
FindAuthorByID returns an Author for the ID matching the parameter
func (Repository) FindAuthors ¶
func (r Repository) FindAuthors() ([]*krautreporter.Author, error)
FindAuthors returns a slice of all Authors
func (Repository) FindOutdatedArticles ¶
func (r Repository) FindOutdatedArticles() ([]*krautreporter.Article, error)
FindOutdatedArticles returns a slice of Articles that need to be scraped
func (Repository) FindOutdatedAuthors ¶
func (r Repository) FindOutdatedAuthors() ([]*krautreporter.Author, error)
FindOutdatedAuthors returns a slice of Authors that need to be scraped
func (Repository) NextCrawls ¶
func (r Repository) NextCrawls(limit int) ([]*krautreporter.Crawl, error)
NextCrawls gets the next crawls limited by number
func (Repository) SaveAllArticles ¶
func (r Repository) SaveAllArticles(articles []*krautreporter.Article) error
SaveAllArticles takes a slice of Article and saves them to the database
func (Repository) SaveAllAuthors ¶
func (r Repository) SaveAllAuthors(authors []*krautreporter.Author) error
SaveAllAuthors takes a slice of Author and saves them to the database
func (Repository) SaveArticle ¶
func (r Repository) SaveArticle(article *krautreporter.Article) error
SaveArticle takes an Article and saves it to the database
func (Repository) SaveAuthor ¶
func (r Repository) SaveAuthor(author *krautreporter.Author) error
SaveAuthor takes an Author and saves it to the database