github.com/jacekolszak/noteo@v0.5.0/notes/notes.go (about) 1 package notes 2 3 import ( 4 "time" 5 6 "github.com/jacekolszak/noteo/tag" 7 ) 8 9 type Note interface { 10 Modified() (time.Time, error) 11 Created() (time.Time, error) 12 Path() string 13 Tags() ([]tag.Tag, error) 14 Body() (string, error) 15 } 16 17 func FindTagByName(note Note, name string) (tag.Tag, bool, error) { 18 tags, err := note.Tags() 19 if err != nil { 20 return tag.Tag{}, false, err 21 } 22 for _, t := range tags { 23 if t.Name() == name { 24 return t, true, nil 25 } 26 } 27 return tag.Tag{}, false, nil 28 }