diff options
author | Reto Brunner <reto@labrat.space> | 2019-12-21 16:21:26 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-12-21 11:20:11 -0500 |
commit | 40ceee969bd29508c1da28052c95eb85a52650ba (patch) | |
tree | 0224774c182196a7352496c7f461136285de0471 /worker/notmuch/lib | |
parent | 2705d8460d7e974ee01ad41ce063ae3feeb30317 (diff) |
notmuch: emit LabelList event
Diffstat (limited to 'worker/notmuch/lib')
-rw-r--r-- | worker/notmuch/lib/database.go | 17 |
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) { |