Turn updateDateTime into *Date.Update
This commit is contained in:
26
feed.go
26
feed.go
@@ -38,7 +38,7 @@ func NewFeed(title string) *Feed {
|
||||
// AddAuthor adds the Person as an author to the Feed. It returns its index as
|
||||
// an int.
|
||||
func (f *Feed) AddAuthor(p *Person) int {
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return addToSlice(&f.Authors, p)
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ func (f *Feed) DeleteAuthor(index int) error {
|
||||
return fmt.Errorf("error deleting author %v from entry %v: %v", index, f.ID.URI, err)
|
||||
}
|
||||
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddCategory adds the Category to the Feed. It returns its index as an int.
|
||||
func (f *Feed) AddCategory(c *Category) int {
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return addToSlice(&f.Categories, c)
|
||||
}
|
||||
|
||||
@@ -65,14 +65,14 @@ func (f *Feed) DeleteCategory(index int) error {
|
||||
return fmt.Errorf("error deleting category %v from entry %v: %v", index, f.ID.URI, err)
|
||||
}
|
||||
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddContributor adds the Person as a contributor to the Feed. It returns its
|
||||
// index as an int.
|
||||
func (f *Feed) AddContributor(c *Person) int {
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return addToSlice(&f.Contributors, c)
|
||||
}
|
||||
|
||||
@@ -83,14 +83,14 @@ func (f *Feed) DeleteContributor(index int) error {
|
||||
return fmt.Errorf("error deleting contributor %v from entry %v: %v", index, f.ID.URI, err)
|
||||
}
|
||||
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddLink adds the Link to the Feed. There should be one Link with Rel "self".
|
||||
// It returns its index as an int.
|
||||
func (f *Feed) AddLink(l *Link) int {
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return addToSlice(&f.Links, l)
|
||||
}
|
||||
|
||||
@@ -100,13 +100,13 @@ func (f *Feed) DeleteLink(index int) error {
|
||||
return fmt.Errorf("error deleting link %v from entry %v: %v", index, f.ID.URI, err)
|
||||
}
|
||||
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddExtension adds the Extension to the Feed. It returns its index as an int.
|
||||
func (f *Feed) AddExtension(e *ExtensionElement) int {
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return addToSlice(&f.Extensions, e)
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ func (f *Feed) DeleteExtension(index int) error {
|
||||
return fmt.Errorf("error deleting extension %v from entry %v: %v", index, f.ID.URI, err)
|
||||
}
|
||||
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddEntry adds the Entry to the Feed. It returns its index as an int.
|
||||
func (f *Feed) AddEntry(e *Entry) int {
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return addToSlice(&f.Entries, e)
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ func (f *Feed) DeleteEntry(index int) error {
|
||||
return fmt.Errorf("error deleting entry %v from entry %v: %v", index, f.ID.URI, err)
|
||||
}
|
||||
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ func (f *Feed) DeleteEntryByURI(uri string) error {
|
||||
}
|
||||
|
||||
f.Entries = append(f.Entries[:index], f.Entries[index+1:]...)
|
||||
updateDateTime(f.Updated)
|
||||
f.Updated.Update()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user