aboutsummaryrefslogtreecommitdiff
path: root/worker/notmuch/lib/database.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/notmuch/lib/database.go')
-rw-r--r--worker/notmuch/lib/database.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go
index f4fd588..0706bbc 100644
--- a/worker/notmuch/lib/database.go
+++ b/worker/notmuch/lib/database.go
@@ -55,6 +55,23 @@ func (db *DB) connectRO() error {
return nil
}
+// ListTags lists all known tags
+func (db *DB) ListTags() ([]string, error) {
+ if db.ro == nil {
+ return nil, fmt.Errorf("not connected to the notmuch db")
+ }
+ tags, err := db.ro.Tags()
+ if err != nil {
+ return nil, err
+ }
+ var result []string
+ var tag *notmuch.Tag
+ for tags.Next(&tag) {
+ result = append(result, tag.Value)
+ }
+ return result, nil
+}
+
//getQuery returns a query based on the provided query string.
//It also configures the query as specified on the worker
func (db *DB) newQuery(query string) (*notmuch.Query, error) {