2009-11-23 12:46:12 +00:00
|
|
|
package feeder
|
|
|
|
|
|
|
|
type Item struct {
|
|
|
|
// RSS and Shared fields
|
2010-05-23 14:21:30 +00:00
|
|
|
Title string
|
2010-12-17 23:25:16 +00:00
|
|
|
Links []*Link
|
2010-05-23 14:21:30 +00:00
|
|
|
Description string
|
|
|
|
Author Author
|
2010-12-17 23:25:16 +00:00
|
|
|
Categories []*Category
|
2010-05-23 14:21:30 +00:00
|
|
|
Comments string
|
2010-12-17 23:25:16 +00:00
|
|
|
Enclosures []*Enclosure
|
2013-11-28 09:22:09 +00:00
|
|
|
Guid *string
|
2010-05-23 14:21:30 +00:00
|
|
|
PubDate string
|
2010-12-17 23:25:16 +00:00
|
|
|
Source *Source
|
2009-11-23 12:46:12 +00:00
|
|
|
|
|
|
|
// Atom specific fields
|
2010-05-23 14:21:30 +00:00
|
|
|
Id string
|
2010-12-17 23:25:16 +00:00
|
|
|
Generator *Generator
|
2010-05-23 14:21:30 +00:00
|
|
|
Contributors []string
|
2010-12-17 23:25:16 +00:00
|
|
|
Content *Content
|
2009-11-23 12:46:12 +00:00
|
|
|
}
|
2013-12-05 15:04:00 +00:00
|
|
|
|
|
|
|
func (i *Item) Key() string {
|
|
|
|
switch {
|
|
|
|
case i.Guid != nil && len(*i.Guid) != 0:
|
|
|
|
return *i.Guid
|
|
|
|
case len(i.Id) != 0:
|
|
|
|
return i.Id
|
|
|
|
default:
|
|
|
|
return i.Title + i.PubDate
|
|
|
|
}
|
|
|
|
}
|