Adds Key()
This commit is contained in:
parent
3b336dc54b
commit
6b6086e389
3 changed files with 22 additions and 2 deletions
11
item.go
11
item.go
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue