diff options
author | Michael Muré <batolettre@gmail.com> | 2020-03-22 13:53:34 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-03-28 17:13:28 +0100 |
commit | 314fcbb2293d869c33d6a76aedd148aedff6561d (patch) | |
tree | 05386ddf08d7e1c2947a6fc6cf2fbd44efa19eaf /cache/repo_cache.go | |
parent | 5e4dc87ffec7f87bbf3ebfcf256777ad773e8450 (diff) | |
download | git-bug-314fcbb2293d869c33d6a76aedd148aedff6561d.tar.gz |
query: no need for an ast package
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r-- | cache/repo_cache.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go index 6546b15e..f2e1c7d0 100644 --- a/cache/repo_cache.go +++ b/cache/repo_cache.go @@ -18,7 +18,7 @@ import ( "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/identity" - "github.com/MichaelMure/git-bug/query/ast" + "github.com/MichaelMure/git-bug/query" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/git" "github.com/MichaelMure/git-bug/util/process" @@ -526,15 +526,15 @@ func (c *RepoCache) resolveBugMatcher(f func(*BugExcerpt) bool) (entity.Id, erro } // QueryBugs return the id of all Bug matching the given Query -func (c *RepoCache) QueryBugs(query *ast.Query) []entity.Id { +func (c *RepoCache) QueryBugs(q *query.Query) []entity.Id { c.muBug.RLock() defer c.muBug.RUnlock() - if query == nil { + if q == nil { return c.AllBugsIds() } - matcher := compileMatcher(query.Filters) + matcher := compileMatcher(q.Filters) var filtered []*BugExcerpt @@ -546,21 +546,21 @@ func (c *RepoCache) QueryBugs(query *ast.Query) []entity.Id { var sorter sort.Interface - switch query.OrderBy { - case ast.OrderById: + switch q.OrderBy { + case query.OrderById: sorter = BugsById(filtered) - case ast.OrderByCreation: + case query.OrderByCreation: sorter = BugsByCreationTime(filtered) - case ast.OrderByEdit: + case query.OrderByEdit: sorter = BugsByEditTime(filtered) default: panic("missing sort type") } - switch query.OrderDirection { - case ast.OrderAscending: + switch q.OrderDirection { + case query.OrderAscending: // Nothing to do - case ast.OrderDescending: + case query.OrderDescending: sorter = sort.Reverse(sorter) default: panic("missing sort direction") |