aboutsummaryrefslogtreecommitdiffstats
path: root/query
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-08-20 10:52:11 +0200
committerMichael Muré <batolettre@gmail.com>2022-08-20 10:52:11 +0200
commit8818d091e85087766d7f493b7dfaf1aedc3a4ab0 (patch)
treea3bd60a9f533fc6fc11a094038d095510210cd23 /query
parent58df94d38d754bff4dcca11e2ae4b99326a9a87e (diff)
downloadgit-bug-8818d091e85087766d7f493b7dfaf1aedc3a4ab0.tar.gz
move bug.Status in entities/common for reuse
Diffstat (limited to 'query')
-rw-r--r--query/parser.go4
-rw-r--r--query/parser_test.go8
-rw-r--r--query/query.go6
3 files changed, 10 insertions, 8 deletions
diff --git a/query/parser.go b/query/parser.go
index 68eda6bb..03b36c0d 100644
--- a/query/parser.go
+++ b/query/parser.go
@@ -3,7 +3,7 @@ package query
import (
"fmt"
- "github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
)
// Parse parse a query DSL
@@ -32,7 +32,7 @@ func Parse(query string) (*Query, error) {
case tokenKindKV:
switch t.qualifier {
case "status", "state":
- status, err := bug.StatusFromString(t.value)
+ status, err := common.StatusFromString(t.value)
if err != nil {
return nil, err
}
diff --git a/query/parser_test.go b/query/parser_test.go
index d07f8514..f2aeb0e9 100644
--- a/query/parser_test.go
+++ b/query/parser_test.go
@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/require"
- "github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
)
func TestParse(t *testing.T) {
@@ -18,10 +18,10 @@ func TestParse(t *testing.T) {
{":value", nil},
{"status:open", &Query{
- Filters: Filters{Status: []bug.Status{bug.OpenStatus}},
+ Filters: Filters{Status: []common.Status{common.OpenStatus}},
}},
{"status:closed", &Query{
- Filters: Filters{Status: []bug.Status{bug.ClosedStatus}},
+ Filters: Filters{Status: []common.Status{common.ClosedStatus}},
}},
{"status:unknown", nil},
@@ -84,7 +84,7 @@ func TestParse(t *testing.T) {
&Query{
Search: []string{"search", "more terms"},
Filters: Filters{
- Status: []bug.Status{bug.OpenStatus},
+ Status: []common.Status{common.OpenStatus},
Author: []string{"René Descartes"},
Participant: []string{"leonhard"},
Label: []string{"hello", "Good first issue"},
diff --git a/query/query.go b/query/query.go
index db507499..6b53ecd9 100644
--- a/query/query.go
+++ b/query/query.go
@@ -1,6 +1,8 @@
package query
-import "github.com/MichaelMure/git-bug/entities/bug"
+import (
+ "github.com/MichaelMure/git-bug/entities/common"
+)
// Query is the intermediary representation of a Bug's query. It is either
// produced by parsing a query string (ex: "status:open author:rene") or created
@@ -31,7 +33,7 @@ type StringPair struct {
// Filters is a collection of Filter that implement a complex filter
type Filters struct {
- Status []bug.Status
+ Status []common.Status
Author []string
Metadata []StringPair
Actor []string