forked from mikkeloscar/aur
-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
93 lines (88 loc) · 2.08 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package aur
// Pkg holds package information.
type Pkg struct {
ID int `json:"ID"`
Name string `json:"Name"`
PackageBaseID int `json:"PackageBaseID"`
PackageBase string `json:"PackageBase"`
Version string `json:"Version"`
Description string `json:"Description"`
URL string `json:"URL"`
NumVotes int `json:"NumVotes"`
Popularity float64 `json:"Popularity"`
OutOfDate int `json:"OutOfDate"`
Maintainer string `json:"Maintainer"`
Submitter string `json:"Submitter"`
FirstSubmitted int `json:"FirstSubmitted"`
LastModified int `json:"LastModified"`
URLPath string `json:"URLPath"`
Depends []string `json:"Depends"`
MakeDepends []string `json:"MakeDepends"`
CheckDepends []string `json:"CheckDepends"`
Conflicts []string `json:"Conflicts"`
Provides []string `json:"Provides"`
Replaces []string `json:"Replaces"`
OptDepends []string `json:"OptDepends"`
Groups []string `json:"Groups"`
License []string `json:"License"`
Keywords []string `json:"Keywords"`
CoMaintainers []string `json:"CoMaintainers"`
}
func (p *Pkg) String() string {
return p.Name
}
// By specifies what to search by in RPC searches.
type By int
const (
Name By = iota + 1
NameDesc
Maintainer
Submitter
Depends
MakeDepends
OptDepends
CheckDepends
None
Provides
Conflicts
Replaces
Keywords
Groups
CoMaintainers
)
func (by By) String() string {
switch by {
case Name:
return "name"
case NameDesc:
return "name-desc"
case Maintainer:
return "maintainer"
case Submitter:
return "submitter"
case Depends:
return "depends"
case MakeDepends:
return "makedepends"
case OptDepends:
return "optdepends"
case CheckDepends:
return "checkdepends"
case None:
return ""
case Provides:
return "provides"
case Conflicts:
return "conflicts"
case Replaces:
return "replaces"
case Keywords:
return "keywords"
case Groups:
return "groups"
case CoMaintainers:
return "comaintainers"
default:
panic("invalid By")
}
}