Rename id in Delete methods to index
This commit is contained in:
30
source.go
30
source.go
@@ -34,9 +34,9 @@ func (s *Source) AddAuthor(p *Person) {
|
||||
}
|
||||
|
||||
// DeleteAuthor deletes the Person from the Source. It return an error.
|
||||
func (s *Source) DeleteAuthor(id int) error {
|
||||
if err := deleteFromSlice(&s.Authors, id); err != nil {
|
||||
return fmt.Errorf("error deleting author %v from source %v: %v", id, s, err)
|
||||
func (s *Source) DeleteAuthor(index int) error {
|
||||
if err := deleteFromSlice(&s.Authors, index); err != nil {
|
||||
return fmt.Errorf("error deleting author %v from source %v: %v", index, s, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -47,9 +47,9 @@ func (s *Source) AddCategory(c *Category) {
|
||||
}
|
||||
|
||||
// DeleteCategory deletes the Category from the Source. It return an error.
|
||||
func (s *Source) DeleteCategory(id int) error {
|
||||
if err := deleteFromSlice(&s.Categories, id); err != nil {
|
||||
return fmt.Errorf("error deleting category %v from source %v: %v", id, s, err)
|
||||
func (s *Source) DeleteCategory(index int) error {
|
||||
if err := deleteFromSlice(&s.Categories, index); err != nil {
|
||||
return fmt.Errorf("error deleting category %v from source %v: %v", index, s, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -60,9 +60,9 @@ func (s *Source) AddContributor(c *Person) {
|
||||
}
|
||||
|
||||
// DeleteContributor deletes the Person from the Source. It return an error.
|
||||
func (s *Source) DeleteContributor(id int) error {
|
||||
if err := deleteFromSlice(&s.Contributors, id); err != nil {
|
||||
return fmt.Errorf("error deleting contributor %v from source %v: %v", id, s, err)
|
||||
func (s *Source) DeleteContributor(index int) error {
|
||||
if err := deleteFromSlice(&s.Contributors, index); err != nil {
|
||||
return fmt.Errorf("error deleting contributor %v from source %v: %v", index, s, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -73,9 +73,9 @@ func (s *Source) AddLink(l *Link) {
|
||||
}
|
||||
|
||||
// DeleteLink deletes the Link from the Source. It return an error.
|
||||
func (s *Source) DeleteLink(id int) error {
|
||||
if err := deleteFromSlice(&s.Links, id); err != nil {
|
||||
return fmt.Errorf("error deleting link %v from source %v: %v", id, s, err)
|
||||
func (s *Source) DeleteLink(index int) error {
|
||||
if err := deleteFromSlice(&s.Links, index); err != nil {
|
||||
return fmt.Errorf("error deleting link %v from source %v: %v", index, s, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -86,9 +86,9 @@ func (s *Source) AddExtension(e *ExtensionElement) {
|
||||
}
|
||||
|
||||
// DeleteExtension deletes the Extension from the Source. It return an error.
|
||||
func (s *Source) DeleteExtension(id int) error {
|
||||
if err := deleteFromSlice(&s.Extensions, id); err != nil {
|
||||
return fmt.Errorf("error deleting extension %v from source %v: %v", id, s, err)
|
||||
func (s *Source) DeleteExtension(index int) error {
|
||||
if err := deleteFromSlice(&s.Extensions, index); err != nil {
|
||||
return fmt.Errorf("error deleting extension %v from source %v: %v", index, s, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user