aboutsummaryrefslogtreecommitdiffstats
path: root/query/ast/ast.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-03-14 16:47:38 +0100
committerMichael Muré <batolettre@gmail.com>2020-03-28 17:13:27 +0100
commit5e4dc87ffec7f87bbf3ebfcf256777ad773e8450 (patch)
tree04553cfb7ab8ea279c7415586ce1d0fe5c819996 /query/ast/ast.go
parent58abc6b0a35b679ac0c34579ff1cb53c8fa71af4 (diff)
downloadgit-bug-5e4dc87ffec7f87bbf3ebfcf256777ad773e8450.tar.gz
cache: replace the all-in-one query parser by a complete one with AST/lexer/parser
Diffstat (limited to 'query/ast/ast.go')
-rw-r--r--query/ast/ast.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/query/ast/ast.go b/query/ast/ast.go
new file mode 100644
index 00000000..fe77abf9
--- /dev/null
+++ b/query/ast/ast.go
@@ -0,0 +1,45 @@
+package ast
+
+import "github.com/MichaelMure/git-bug/bug"
+
+type Query struct {
+ Filters
+ OrderBy
+ OrderDirection
+}
+
+// NewQuery return an identity query with the default sorting (creation-desc).
+func NewQuery() *Query {
+ return &Query{
+ OrderBy: OrderByCreation,
+ OrderDirection: OrderDescending,
+ }
+}
+
+// Filters is a collection of Filter that implement a complex filter
+type Filters struct {
+ Status []bug.Status
+ Author []string
+ Actor []string
+ Participant []string
+ Label []string
+ Title []string
+ NoLabel bool
+}
+
+type OrderBy int
+
+const (
+ _ OrderBy = iota
+ OrderById
+ OrderByCreation
+ OrderByEdit
+)
+
+type OrderDirection int
+
+const (
+ _ OrderDirection = iota
+ OrderAscending
+ OrderDescending
+)