aboutsummaryrefslogtreecommitdiffstats
path: root/termui
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-09 20:21:49 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-09 20:22:27 +0200
commit09e097e1bf32ad153c139e3f6befad9fb059fd6e (patch)
tree422db558f5ead4ec673bca6a2ede413514d49d5b /termui
parent21f9840e991ae569ec1efa404011e9a16ed2ab3b (diff)
downloadgit-bug-09e097e1bf32ad153c139e3f6befad9fb059fd6e.tar.gz
cache: combine sorting and filtering into a query with its micro-DSL
Diffstat (limited to 'termui')
-rw-r--r--termui/bug_table.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go
index e4a2be24..8b50f07b 100644
--- a/termui/bug_table.go
+++ b/termui/bug_table.go
@@ -20,15 +20,20 @@ const remote = "origin"
type bugTable struct {
repo *cache.RepoCache
+ query *cache.Query
allIds []string
bugs []*cache.BugCache
pageCursor int
selectCursor int
}
-func newBugTable(cache *cache.RepoCache) *bugTable {
+func newBugTable(c *cache.RepoCache) *bugTable {
return &bugTable{
- repo: cache,
+ repo: c,
+ query: &cache.Query{
+ OrderBy: cache.OrderByCreation,
+ OrderDirection: cache.OrderAscending,
+ },
pageCursor: 0,
selectCursor: 0,
}
@@ -212,7 +217,7 @@ func (bt *bugTable) disable(g *gocui.Gui) error {
}
func (bt *bugTable) paginate(max int) error {
- bt.allIds = bt.repo.AllBugsId(cache.OrderByCreation, cache.OrderAscending)
+ bt.allIds = bt.repo.QueryBugs(bt.query)
return bt.doPaginate(max)
}