Skip to content

Commit

Permalink
Update mode to use Int
Browse files Browse the repository at this point in the history
Signed-off-by: kbilchenko <kirya7@gmail.com>
  • Loading branch information
kirillbilchenko committed Sep 8, 2021
1 parent 2a6b5d8 commit 30fec67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 2 additions & 7 deletions github_graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (g *GitHubClient) listReleasesV4() ([]*github.RepositoryRelease, error) {
publishedAt, _ := time.ParseInLocation(time.RFC3339, r.Node.PublishedAt.Time.Format(time.RFC3339), time.UTC)
createdAt, _ := time.ParseInLocation(time.RFC3339, r.Node.CreatedAt.Time.Format(time.RFC3339), time.UTC)
var releaseID int64
if r.Node.DatabaseId == "" {
if r.Node.DatabaseId == 0 {
decodedID, err := base64.StdEncoding.DecodeString(r.Node.ID)
if err != nil {
return nil, err
Expand All @@ -65,12 +65,7 @@ func (g *GitHubClient) listReleasesV4() ([]*github.RepositoryRelease, error) {
return nil, err
}
} else {
var id int64
id, err := strconv.ParseInt(r.Node.DatabaseId, 10, 64)
if err != nil {
return nil, err
}
releaseID = id
releaseID = int64(r.Node.DatabaseId)
}

allReleases = append(allReleases, &github.RepositoryRelease{
Expand Down
6 changes: 3 additions & 3 deletions github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
"node": {
"createdAt": "2010-10-01T00:58:07Z",
"id": "MDc6UmVsZWFzZTMyMDk1MTAz",
"databaseId": "32095103",
"databaseId": 32095103,
"name": "xyz",
"publishedAt": "2010-10-02T15:39:53Z",
"tagName": "xyz",
Expand All @@ -38,7 +38,7 @@ const (
"node": {
"createdAt": "2010-08-27T13:55:36Z",
"id": "MDc6UmVsZWFzZTMwMjMwNjU5",
"databaseId": "30230659",
"databaseId": 30230659,
"name": "xyz",
"publishedAt": "2010-08-27T17:18:06Z",
"tagName": "xyz",
Expand Down Expand Up @@ -66,7 +66,7 @@ const (
"node": {
"createdAt": "2010-10-10T01:01:07Z",
"id": "MDc6UmVsZWFzZTMzMjIyMjQz",
"databaseId":"33222243",
"databaseId": 33222243,
"name": "xyq",
"publishedAt": "2010-10-10T15:39:53Z",
"tagName": "xyq",
Expand Down
2 changes: 1 addition & 1 deletion model.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type ReleaseObject struct {
CreatedAt githubv4.DateTime `graphql:"createdAt"`
PublishedAt githubv4.DateTime `graphql:"publishedAt"`
ID string `graphql:"id"`
DatabaseId string `graphql:"databaseId"`
DatabaseId githubv4.Int `graphql:"databaseId"`
IsDraft bool `graphql:"isDraft"`
IsPrerelease bool `graphql:"isPrerelease"`
Name string `graphql:"name"`
Expand Down

0 comments on commit 30fec67

Please sign in to comment.