forked from
tangled.org/core
Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
1package models
2
3import "tangled.org/core/appview/pagination"
4
5type IssueSearchOptions struct {
6 Keywords []string
7 Phrases []string
8 RepoAt string
9 IsOpen *bool
10 AuthorDid string
11 Labels []string
12 LabelValues []string
13
14 NegatedKeywords []string
15 NegatedPhrases []string
16 NegatedLabels []string
17 NegatedLabelValues []string
18 NegatedAuthorDids []string
19
20 Page pagination.Page
21}
22
23func (o *IssueSearchOptions) HasSearchFilters() bool {
24 return len(o.Keywords) > 0 || len(o.Phrases) > 0 ||
25 o.AuthorDid != "" || len(o.NegatedAuthorDids) > 0 ||
26 len(o.Labels) > 0 || len(o.NegatedLabels) > 0 ||
27 len(o.LabelValues) > 0 || len(o.NegatedLabelValues) > 0 ||
28 len(o.NegatedKeywords) > 0 || len(o.NegatedPhrases) > 0
29}
30
31type PullSearchOptions struct {
32 Keywords []string
33 Phrases []string
34 RepoAt string
35 State *PullState
36 AuthorDid string
37 Labels []string
38 LabelValues []string
39
40 NegatedKeywords []string
41 NegatedPhrases []string
42 NegatedLabels []string
43 NegatedLabelValues []string
44 NegatedAuthorDids []string
45
46 Page pagination.Page
47}
48
49func (o *PullSearchOptions) HasSearchFilters() bool {
50 return len(o.Keywords) > 0 || len(o.Phrases) > 0 ||
51 o.AuthorDid != "" || len(o.NegatedAuthorDids) > 0 ||
52 len(o.Labels) > 0 || len(o.NegatedLabels) > 0 ||
53 len(o.LabelValues) > 0 || len(o.NegatedLabelValues) > 0 ||
54 len(o.NegatedKeywords) > 0 || len(o.NegatedPhrases) > 0
55}
56
57type RepoSearchOptions struct {
58 Keywords []string // text search across name, description, website, topics
59 Phrases []string // phrase search
60
61 Language string // exact match on primary language
62 Knot string // filter by knot domain
63 Did string // filter by owner DID
64 Topics []string // exact topic matches
65
66 NegatedKeywords []string
67 NegatedPhrases []string
68 NegatedTopics []string
69
70 Page pagination.Page
71}
72
73func (o *RepoSearchOptions) HasSearchFilters() bool {
74 return len(o.Keywords) > 0 || len(o.Phrases) > 0 ||
75 o.Language != "" || o.Did != "" ||
76 len(o.Topics) > 0 || len(o.NegatedTopics) > 0 ||
77 len(o.NegatedKeywords) > 0 || len(o.NegatedPhrases) > 0
78}