-
Notifications
You must be signed in to change notification settings - Fork 276
/
Copy pathversion_sort_by.go
49 lines (46 loc) · 1.1 KB
/
version_sort_by.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
package models
type VersionSortBy int
const (
GROUPID_VERSIONSORTBY VersionSortBy = iota
ARTIFACTID_VERSIONSORTBY
VERSION_VERSIONSORTBY
NAME_VERSIONSORTBY
CREATEDON_VERSIONSORTBY
MODIFIEDON_VERSIONSORTBY
GLOBALID_VERSIONSORTBY
)
func (i VersionSortBy) String() string {
return []string{"groupId", "artifactId", "version", "name", "createdOn", "modifiedOn", "globalId"}[i]
}
func ParseVersionSortBy(v string) (any, error) {
result := GROUPID_VERSIONSORTBY
switch v {
case "groupId":
result = GROUPID_VERSIONSORTBY
case "artifactId":
result = ARTIFACTID_VERSIONSORTBY
case "version":
result = VERSION_VERSIONSORTBY
case "name":
result = NAME_VERSIONSORTBY
case "createdOn":
result = CREATEDON_VERSIONSORTBY
case "modifiedOn":
result = MODIFIEDON_VERSIONSORTBY
case "globalId":
result = GLOBALID_VERSIONSORTBY
default:
return nil, nil
}
return &result, nil
}
func SerializeVersionSortBy(values []VersionSortBy) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i VersionSortBy) isMultiValue() bool {
return false
}