-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
172 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea/ | ||
.vscode/ | ||
*.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,57 @@ | ||
package main | ||
|
||
import "time" | ||
import ( | ||
"time" | ||
) | ||
|
||
type GraphQLData struct { | ||
Search struct { | ||
PageInfo struct { | ||
HasNextPage bool `json:"hasNextPage"` | ||
EndCursor string `json:"endCursor"` | ||
} `json:"pageInfo"` | ||
Nodes []struct { | ||
NameWithOwner string `json:"nameWithOwner"` | ||
StargazerCount int `json:"stargazerCount"` | ||
CreatedAt time.Time `json:"createdAt"` | ||
UpdatedAt time.Time `json:"updatedAt"` | ||
PullRequests struct { | ||
TotalCount int `json:"totalCount"` | ||
} `json:"pullRequests"` | ||
Releases struct { | ||
TotalCount int `json:"totalCount"` | ||
} `json:"releases"` | ||
PrimaryLanguage *struct { | ||
Name string `json:"name"` | ||
} `json:"primaryLanguage"` | ||
OpenIssues struct { | ||
TotalCount int `json:"totalCount"` | ||
} `json:"openIssues"` | ||
ClosedIssues struct { | ||
TotalCount int `json:"totalCount"` | ||
} `json:"closedIssues"` | ||
} `json:"nodes"` | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
module github.com/gamoch/popular_repos | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/cheggaaa/pb/v3 v3.0.8 | ||
github.com/gocarina/gocsv v0.0.0-20210516172204-ca9e8a8ddea8 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM= | ||
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= | ||
github.com/cheggaaa/pb/v3 v3.0.8 h1:bC8oemdChbke2FHIIGy9mn4DPJ2caZYQnfbRqwmdCoA= | ||
github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/ow1EJTA= | ||
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= | ||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= | ||
github.com/gocarina/gocsv v0.0.0-20210516172204-ca9e8a8ddea8 h1:hp1oqdzmv37vPLYFGjuM/RmUgUMfD9vQfMszc54l55Y= | ||
github.com/gocarina/gocsv v0.0.0-20210516172204-ca9e8a8ddea8/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= | ||
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= | ||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= | ||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= | ||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= | ||
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow= | ||
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= | ||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= | ||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= | ||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= | ||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A= | ||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters