Documentation ¶
Index ¶
- type Article
- type ArticleDB
- func (adb *ArticleDB) AllArticles() ([]Article, error)
- func (adb *ArticleDB) BySections(sections []string) ([]Article, error)
- func (adb *ArticleDB) BySectionsAndTags(sections []string, tags []string) ([]Article, error)
- func (adb *ArticleDB) ByTags(tags []string) ([]Article, error)
- func (adb *ArticleDB) ByURL(url string) (*Article, error)
- func (adb *ArticleDB) CleanOldArticles(numberOfArticles int, logger *log.Logger)
- func (adb *ArticleDB) Close() error
- func (adb *ArticleDB) DestructiveReset() error
- func (adb *ArticleDB) Init(uri string) error
- func (adb *ArticleDB) InsertArticle(a Article) error
- type Articles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { URL string `bson:"url,omitempty" json:"url"` Title string `bson:"title,omitempty" json:"title"` Section string `bson:"section,omitempty" json:"section"` PublishedDate string `bson:"date_created,omitempty" json:"published_date"` Text string `bson:"text,omitempty" json:"-"` SummarisedText string `bson:"summarised_text,omitempty"` Tags []string `bson:"tags,omitempty"` }
The document that goes into the (mongo) database.
type ArticleDB ¶
type ArticleDB struct {
// contains filtered or unexported fields
}
func (*ArticleDB) AllArticles ¶
func (*ArticleDB) BySections ¶
Query the articles by sections
func (*ArticleDB) BySectionsAndTags ¶
Query the articles by tags and sections
func (*ArticleDB) ByURL ¶
ByURL is used in controller packages to check for existing article, assuming the URL of the article never changed and each article has an unique url.
func (*ArticleDB) CleanOldArticles ¶
Delete old articles
func (*ArticleDB) DestructiveReset ¶
Remove all documents in "articles" collection by dropping the collection and create it again.
func (*ArticleDB) InsertArticle ¶
Insert an article/document into the mongo database
Click to show internal directories.
Click to hide internal directories.