Adds Key()

This commit is contained in:
Harm Aarts 2013-12-05 16:04:00 +01:00
parent 3b336dc54b
commit 6b6086e389
3 changed files with 22 additions and 2 deletions

11
item.go
View file

@ -19,3 +19,14 @@ type Item struct {
Contributors []string
Content *Content
}
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
}
}