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	Filters
11	OrderBy
12	OrderDirection
13}
14
15// NewQuery return an identity query with the default sorting (creation-desc).
16func NewQuery() *Query {
17	return &Query{
18		OrderBy:        OrderByCreation,
19		OrderDirection: OrderDescending,
20	}
21}
22
23// Filters is a collection of Filter that implement a complex filter
24type Filters struct {
25	Status      []bug.Status
26	Author      []string
27	Actor       []string
28	Participant []string
29	Label       []string
30	Title       []string
31	NoLabel     bool
32}
33
34type OrderBy int
35
36const (
37	_ OrderBy = iota
38	OrderById
39	OrderByCreation
40	OrderByEdit
41)
42
43type OrderDirection int
44
45const (
46	_ OrderDirection = iota
47	OrderAscending
48	OrderDescending
49)