Added and corrected comments
This commit is contained in:
22
entry.go
22
entry.go
@@ -28,6 +28,8 @@ type Entry struct {
|
||||
Extensions []*ExtensionElement `xml:",any,omitempty"`
|
||||
}
|
||||
|
||||
// checkAuthors checks the entry's authors for incompatibilities with RFC4287.
|
||||
// It returns an errors.
|
||||
// atom:entry elements MUST contain one or more atom:author elements, unless
|
||||
// the atom:entry contains an atom:source element that contains an atom:author
|
||||
// element or, in an Atom Feed Document, the atom:feed element contains an
|
||||
@@ -48,17 +50,21 @@ func (e *Entry) checkAuthors() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func alternateRelExists(l []*Link) bool {
|
||||
for _, link := range l {
|
||||
if link.Rel == "alternate" {
|
||||
return true
|
||||
}
|
||||
// NewEntry creates a new Entry. It returns a *Entry and an error.
|
||||
func NewEntry(title string) (*Entry, error) {
|
||||
text, err := NewText("text", title)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating new entry: %v", err)
|
||||
}
|
||||
|
||||
return false
|
||||
return &Entry{
|
||||
ID: NewID(),
|
||||
Title: text,
|
||||
Updated: NewDate(time.Now()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// AddExtension adds the extension to the entry
|
||||
// AddExtension adds the ExtensionElement to the Entry.
|
||||
func (e *Entry) AddExtension(x *ExtensionElement) {
|
||||
if e.Extensions == nil {
|
||||
e.Extensions = make([]*ExtensionElement, 1)
|
||||
@@ -70,6 +76,8 @@ func (e *Entry) AddExtension(x *ExtensionElement) {
|
||||
e.Updated.DateTime = DateTime(time.Now())
|
||||
}
|
||||
|
||||
// Check checks the Entry for incompatibilities with RFC4287. It returns an
|
||||
// error.
|
||||
func (e *Entry) Check() error {
|
||||
if e.ID == nil {
|
||||
return errors.New("no id element of entry")
|
||||
|
Reference in New Issue
Block a user