Return the index of the added element
This commit is contained in:
36
feed.go
36
feed.go
@@ -35,10 +35,10 @@ func NewFeed(title string) *Feed {
|
||||
}
|
||||
}
|
||||
|
||||
// AddAuthor adds the Person as an author to the Feed.
|
||||
func (f *Feed) AddAuthor(p *Person) {
|
||||
addToSlice(&f.Authors, p)
|
||||
// AddAuthor adds the Person as an author to the Feed. It returns an int.
|
||||
func (f *Feed) AddAuthor(p *Person) int {
|
||||
f.Updated = NewDate(time.Now())
|
||||
return addToSlice(&f.Authors, p)
|
||||
}
|
||||
|
||||
// DeleteAuthor deletes the Person at index from the Feed. It return an error.
|
||||
@@ -51,10 +51,10 @@ func (f *Feed) DeleteAuthor(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddCategory adds the Category to the Feed.
|
||||
func (f *Feed) AddCategory(c *Category) {
|
||||
addToSlice(&f.Categories, c)
|
||||
// AddCategory adds the Category to the Feed. It returns an int.
|
||||
func (f *Feed) AddCategory(c *Category) int {
|
||||
f.Updated = NewDate(time.Now())
|
||||
return addToSlice(&f.Categories, c)
|
||||
}
|
||||
|
||||
// DeleteCategory deletes the Category at index from the Feed. It return an
|
||||
@@ -68,10 +68,11 @@ func (f *Feed) DeleteCategory(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddContributor adds the Person as a contributor to the Feed.
|
||||
func (f *Feed) AddContributor(c *Person) {
|
||||
addToSlice(&f.Contributors, c)
|
||||
// AddContributor adds the Person as a contributor to the Feed. It returns an
|
||||
// int.
|
||||
func (f *Feed) AddContributor(c *Person) int {
|
||||
f.Updated = NewDate(time.Now())
|
||||
return addToSlice(&f.Contributors, c)
|
||||
}
|
||||
|
||||
// DeleteContributor deletes the Person at index from the Feed. It return an
|
||||
@@ -86,9 +87,10 @@ func (f *Feed) DeleteContributor(index int) error {
|
||||
}
|
||||
|
||||
// AddLink adds the Link to the Feed. There should be one Link with Rel "self".
|
||||
func (f *Feed) AddLink(l *Link) {
|
||||
addToSlice(&f.Links, l)
|
||||
// It returns an int.
|
||||
func (f *Feed) AddLink(l *Link) int {
|
||||
f.Updated = NewDate(time.Now())
|
||||
return addToSlice(&f.Links, l)
|
||||
}
|
||||
|
||||
// DeleteLink deletes the Link at index from the Feed. It return an error.
|
||||
@@ -101,10 +103,10 @@ func (f *Feed) DeleteLink(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddExtension adds the Extension to the Feed.
|
||||
func (f *Feed) AddExtension(e *ExtensionElement) {
|
||||
addToSlice(&f.Extensions, e)
|
||||
// AddExtension adds the Extension to the Feed. It returns an int.
|
||||
func (f *Feed) AddExtension(e *ExtensionElement) int {
|
||||
f.Updated = NewDate(time.Now())
|
||||
return addToSlice(&f.Extensions, e)
|
||||
}
|
||||
|
||||
// DeleteExtension deletes the Extension at index from the Feed. It return an
|
||||
@@ -118,10 +120,10 @@ func (f *Feed) DeleteExtension(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddEntry adds the Entry to the Feed.
|
||||
func (f *Feed) AddEntry(e *Entry) {
|
||||
addToSlice(&f.Entries, e)
|
||||
// AddEntry adds the Entry to the Feed. It returns an int.
|
||||
func (f *Feed) AddEntry(e *Entry) int {
|
||||
f.Updated = NewDate(time.Now())
|
||||
return addToSlice(&f.Entries, e)
|
||||
}
|
||||
|
||||
// DeleteEntry deletes the Entry at index from the Feed. It return an error.
|
||||
|
Reference in New Issue
Block a user