1package query
 2
 3import "github.com/MichaelMure/git-bug/bug"
 4
 5// Query is the intermediary representation of a Bug's query. It is either
 6// produced by parsing a query string (ex: "status:open author:rene") or created
 7// manually. This query doesn't do anything by itself and need to be interpreted
 8// for the specific domain of application.
 9type Query struct {
10	Search
11	Filters
12	OrderBy
13	OrderDirection
14}
15
16// NewQuery return an identity query with the default sorting (creation-desc).
17func NewQuery() *Query {
18	return &Query{
19		OrderBy:        OrderByCreation,
20		OrderDirection: OrderDescending,
21	}
22}
23
24type Search []string
25
26// Filters is a collection of Filter that implement a complex filter
27type Filters struct {
28	Status      []bug.Status
29	Author      []string
30	Actor       []string
31	Participant []string
32	Label       []string
33	Title       []string
34	NoLabel     bool
35}
36
37type OrderBy int
38
39const (
40	_ OrderBy = iota
41	OrderById
42	OrderByCreation
43	OrderByEdit
44)
45
46type OrderDirection int
47
48const (
49	_ OrderDirection = iota
50	OrderAscending
51	OrderDescending
52)