Esempio n. 1
0
func (src *SourceTwitter) GenerateStories(articles []tempArticle) []stories.Story {
	var ret []stories.Story

	for _, a := range articles {
		story := stories.New(a.title, a.content, a.url, a.pubdate, src.id)
		ret = append(ret, *story)
	}

	return ret
}
Esempio n. 2
0
func (rss *SourceRss) constructStories(articles []tempArticle) []stories.Story {
	var ret []stories.Story

	for i, _ := range articles {
		article := articles[i]
		story := stories.New(article.title, article.content, article.url, article.pubdate, rss.id)
		ret = append(ret, *story)
	}
	return ret
}
Esempio n. 3
0
func (db *Db) FetchStoriesSince(timestamp int64) []*stories.Story {
	result, err := db.connection.Query("SELECT id, url, title, content, pubdate, source_id FROM broccoli_stories WHERE pubdate > ?", timestamp)

	if err != nil {
		fmt.Printf("There was an error when fetching stories since: %s\n", err)
	}

	ret := make([]*stories.Story, 0, 10)
	for result.Next() {
		var id int
		var url string
		var title string
		var content string
		var pubdate int64
		var source_id int
		result.Scan(&id, &url, &title, &content, &pubdate, &source_id)
		ret = append(ret, stories.New(title, content, url, pubdate, source_id))
	}
	return ret
}