-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodel.go
More file actions
59 lines (45 loc) · 856 Bytes
/
model.go
File metadata and controls
59 lines (45 loc) · 856 Bytes
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
package main
import (
"fmt"
"os"
"time"
)
type CommitSummary struct {
Timestamp time.Time
Email string
}
type CommitList []*CommitSummary
type MailMapEntry struct {
ProperEmail string
CommitEmail string
}
func (l CommitList) Len() int {
return len(l)
}
func (l CommitList) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
func (l CommitList) Less(i, j int) bool {
return l[i].Timestamp.Before(l[j].Timestamp)
}
func CheckError(err error) {
if err == nil {
return
}
fmt.Printf("\x1b[31;1m%s\x1b[0m\n", fmt.Sprintf("error: %s", err))
os.Exit(1)
}
type UserMinute struct {
Name string
Minute float64
}
type UserMinutes []*UserMinute
func (l UserMinutes) Len() int {
return len(l)
}
func (l UserMinutes) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
func (l UserMinutes) Less(i, j int) bool {
return l[i].Minute < l[j].Minute
}