/
structures.go
57 lines (51 loc) · 1.6 KB
/
structures.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
package main
import (
"time"
)
type GraphQLData struct {
Search struct {
PageInfo struct {
HasNextPage bool `json:"hasNextPage"`
EndCursor string `json:"endCursor"`
} `json:"pageInfo"`
Nodes []GraphQLNode `json:"nodes"`
} `json:"search"`
}
type GraphQLNode struct {
NameWithOwner string `json:"nameWithOwner"`
StargazerCount int `json:"stargazerCount"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
MergedPullRequests struct {
TotalCount int `json:"totalCount"`
} `json:"mergedPullRequests"`
Releases struct {
TotalCount int `json:"totalCount"`
} `json:"releases"`
PrimaryLanguage struct {
Name string `json:"name"`
} `json:"primaryLanguage"`
Issues struct {
TotalCount int `json:"totalCount"`
} `json:"issues"`
ClosedIssues struct {
TotalCount int `json:"totalCount"`
} `json:"closedIssues"`
}
type Repository struct {
NameWithOwner string `csv:"nameWithOwner"`
StargazerCount int `csv:"stargazerCount"`
Age RepositoryTime `csv:"age"`
TimeUntilLastUpdate RepositoryTime `csv:"timeUntilLastUpdate"`
TotalAcceptedPullRequests int `csv:"totalAcceptedPullRequests"`
TotalReleases int `csv:"totalReleases"`
PrimaryLanguage string `csv:"primaryLanguage"`
PercentageClosedIssues float64 `csv:"percentageClosedIssues"`
}
type RepositoryTime struct {
time.Duration
}
func (t *RepositoryTime) UnmarshalCSV(value string) (err error) {
t.Duration, err = time.ParseDuration(value)
return err
}