示例#1
0
func persistStories(stories []stories.Story, db *database.Db) {
	count := 0
	for _, story := range stories {
		// If the story doesn't already exist, persist it
		if !db.StoryExists(&story) {
			db.PersistStory(&story)
			count += 1
		}
	}
	fmt.Printf("Saved %d new stories\n", count)
}