Make comments more useful
This commit is contained in:
31
source.go
31
source.go
@@ -28,13 +28,14 @@ func NewSource() *Source {
|
||||
return &Source{CommonAttributes: NewCommonAttributes()}
|
||||
}
|
||||
|
||||
// AddAuthor adds the Person as an author to the Source. It returns its index as
|
||||
// an int.
|
||||
func (s *Source) AddAuthor(p *Person) int {
|
||||
return addToSlice(&s.Authors, p)
|
||||
// AddAuthor adds the Person a as an author to the Source. It returns the index
|
||||
// as an int.
|
||||
func (s *Source) AddAuthor(a *Person) int {
|
||||
return addToSlice(&s.Authors, a)
|
||||
}
|
||||
|
||||
// DeleteAuthor deletes the Person at index from the Source. It return an error.
|
||||
// DeleteAuthor deletes the Person at index from the Source. It returns an
|
||||
// error.
|
||||
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)
|
||||
@@ -42,12 +43,12 @@ func (s *Source) DeleteAuthor(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddCategory adds the Category to the Source. It returns its index as an int.
|
||||
// AddCategory adds the Category c to the Source. It returns the index as an int.
|
||||
func (s *Source) AddCategory(c *Category) int {
|
||||
return addToSlice(&s.Categories, c)
|
||||
}
|
||||
|
||||
// DeleteCategory deletes the Category at index from the Source. It return an
|
||||
// DeleteCategory deletes the Category at index from the Source. It returns an
|
||||
// error.
|
||||
func (s *Source) DeleteCategory(index int) error {
|
||||
if err := deleteFromSlice(&s.Categories, index); err != nil {
|
||||
@@ -56,13 +57,13 @@ func (s *Source) DeleteCategory(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddContributor adds the Person as a contributor to the Source. It returns its
|
||||
// index as an int.
|
||||
// AddContributor adds the Person c as a contributor to the Source. It returns
|
||||
// the index as an int.
|
||||
func (s *Source) AddContributor(c *Person) int {
|
||||
return addToSlice(&s.Contributors, c)
|
||||
}
|
||||
|
||||
// DeleteContributor deletes the Person at index from the Source. It return an
|
||||
// DeleteContributor deletes the Person at index from the Source. It returns an
|
||||
// error.
|
||||
func (s *Source) DeleteContributor(index int) error {
|
||||
if err := deleteFromSlice(&s.Contributors, index); err != nil {
|
||||
@@ -71,12 +72,12 @@ func (s *Source) DeleteContributor(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddLink adds the Link to the Source. It returns its index as an int.
|
||||
// AddLink adds the Link l to the Source. It returns the index as an int.
|
||||
func (s *Source) AddLink(l *Link) int {
|
||||
return addToSlice(&s.Links, l)
|
||||
}
|
||||
|
||||
// DeleteLink deletes the Link at index from the Source. It return an error.
|
||||
// DeleteLink deletes the Link at index from the Source. It returns an error.
|
||||
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)
|
||||
@@ -84,13 +85,13 @@ func (s *Source) DeleteLink(index int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddExtension adds the ExtensionElement to the Source. It returns its index as
|
||||
// an int.
|
||||
// AddExtension adds the ExtensionElement e to the Source. It returns the index
|
||||
// as an int.
|
||||
func (s *Source) AddExtension(e *ExtensionElement) int {
|
||||
return addToSlice(&s.Extensions, e)
|
||||
}
|
||||
|
||||
// DeleteExtension deletes the Extension at index from the Source. It return an
|
||||
// DeleteExtension deletes the Extension at index from the Source. It returns an
|
||||
// error.
|
||||
func (s *Source) DeleteExtension(index int) error {
|
||||
if err := deleteFromSlice(&s.Extensions, index); err != nil {
|
||||
|
Reference in New Issue
Block a user