-
Notifications
You must be signed in to change notification settings - Fork 12
/
sort.go
54 lines (45 loc) · 1.01 KB
/
sort.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
package main
type ByFinalOrder []*Field
func (s ByFinalOrder) Len() int {
return len(s)
}
func (s ByFinalOrder) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s ByFinalOrder) Less(i, j int) bool {
return s[i].finalOrder < s[j].finalOrder
}
type ByOrderOfAppearance []*Field
func (s ByOrderOfAppearance) Len() int {
return len(s)
}
func (s ByOrderOfAppearance) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s ByOrderOfAppearance) Less(i, j int) bool {
return s[i].orderOfAppearance < s[j].orderOfAppearance
}
type ByGoName []*Struct
func (s ByGoName) Len() int {
return len(s)
}
func (s ByGoName) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s ByGoName) Less(i, j int) bool {
return s[i].goName < s[j].goName
}
type AlphaHelper struct {
Name string
Code []byte
}
type AlphaHelperSlice []AlphaHelper
func (s AlphaHelperSlice) Len() int {
return len(s)
}
func (s AlphaHelperSlice) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s AlphaHelperSlice) Less(i, j int) bool {
return s[i].Name < s[j].Name
}