Skip to content

Commit

Permalink
🐛 fix time parsing in github (#1863)
Browse files Browse the repository at this point in the history
The child object might be non-pointers, but their parents are all pointers now. Correctly handle nil-values.

Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus authored Sep 23, 2023
1 parent 8263d60 commit 16db0ed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions providers/github/resources/github_org.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func initGithubOrganization(runtime *plugin.Runtime, args map[string]*llx.RawDat
args["followers"] = llx.IntData(convert.ToInt64FromInt(org.Followers))
args["following"] = llx.IntData(convert.ToInt64FromInt(org.Following))
args["description"] = llx.StringDataPtr(org.Description)
args["createdAt"] = llx.TimeData(org.CreatedAt.Time)
args["updatedAt"] = llx.TimeData(org.UpdatedAt.Time)
args["createdAt"] = llx.TimeDataPtr(githubTimestamp(org.CreatedAt))
args["updatedAt"] = llx.TimeDataPtr(githubTimestamp(org.UpdatedAt))
args["totalPrivateRepos"] = llx.IntDataPtr(org.TotalPrivateRepos)
args["ownedPrivateRepos"] = llx.IntDataPtr(org.OwnedPrivateRepos)
args["privateGists"] = llx.IntData(convert.ToInt64FromInt(org.PrivateGists))
Expand Down Expand Up @@ -176,9 +176,9 @@ func (g *mqlGithubOrganization) owners() ([]interface{}, error) {
"following": llx.IntData(int64(member.GetFollowing())),
"twitterUsername": llx.StringData(member.GetTwitterUsername()),
"bio": llx.StringDataPtr(member.Bio),
"createdAt": llx.TimeData(member.CreatedAt.Time),
"updatedAt": llx.TimeData(member.UpdatedAt.Time),
"suspendedAt": llx.TimeData(member.SuspendedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(member.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(member.UpdatedAt)),
"suspendedAt": llx.TimeDataPtr(githubTimestamp(member.SuspendedAt)),
"company": llx.StringDataPtr(member.Company),
})
if err != nil {
Expand Down Expand Up @@ -385,8 +385,8 @@ func (g *mqlGithubOrganization) packages() ([]interface{}, error) {
"name": llx.StringDataPtr(p.Name),
"packageType": llx.StringDataPtr(p.PackageType),
"owner": llx.ResourceData(owner, owner.MqlName()),
"createdAt": llx.TimeData(p.CreatedAt.Time),
"updatedAt": llx.TimeData(p.UpdatedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(p.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(p.UpdatedAt)),
"versionCount": llx.IntDataPtr(p.VersionCount),
"visibility": llx.StringDataPtr(p.Visibility),
})
Expand Down Expand Up @@ -473,8 +473,8 @@ func (g *mqlGithubOrganization) installations() ([]interface{}, error) {
"id": llx.IntData(id),
"appId": llx.IntDataPtr(app.AppID),
"appSlug": llx.StringDataPtr(app.AppSlug),
"createdAt": llx.TimeData(app.CreatedAt.Time),
"updatedAt": llx.TimeData(app.UpdatedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(app.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(app.UpdatedAt)),
})
if err != nil {
return nil, err
Expand Down
24 changes: 12 additions & 12 deletions providers/github/resources/github_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func newMqlGithubRepository(runtime *plugin.Runtime, repo *github.Repository) (*
"homepage": llx.StringDataPtr(repo.Homepage),
"topics": llx.ArrayData(convert.SliceAnyToInterface[string](repo.Topics), types.String),
"language": llx.StringData(repo.GetLanguage()),
"createdAt": llx.TimeData(repo.CreatedAt.Time),
"updatedAt": llx.TimeData(repo.UpdatedAt.Time),
"pushedAt": llx.TimeData(repo.PushedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(repo.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(repo.UpdatedAt)),
"pushedAt": llx.TimeDataPtr(githubTimestamp(repo.PushedAt)),
"archived": llx.BoolDataPtr(repo.Archived),
"disabled": llx.BoolDataPtr(repo.Disabled),
"private": llx.BoolDataPtr(repo.Private),
Expand Down Expand Up @@ -188,9 +188,9 @@ func initGithubRepository(runtime *plugin.Runtime, args map[string]*llx.RawData)
args["forksCount"] = llx.IntData(int64(repo.GetForksCount()))
args["openIssuesCount"] = llx.IntData(int64(repo.GetOpenIssues()))
args["stargazersCount"] = llx.IntData(int64(repo.GetStargazersCount()))
args["createdAt"] = llx.TimeData(repo.CreatedAt.Time)
args["updatedAt"] = llx.TimeData(repo.UpdatedAt.Time)
args["pushedAt"] = llx.TimeData(repo.PushedAt.Time)
args["createdAt"] = llx.TimeDataPtr(githubTimestamp(repo.CreatedAt))
args["updatedAt"] = llx.TimeDataPtr(githubTimestamp(repo.UpdatedAt))
args["pushedAt"] = llx.TimeDataPtr(githubTimestamp(repo.PushedAt))
args["archived"] = llx.BoolDataPtr(repo.Archived)
args["disabled"] = llx.BoolDataPtr(repo.Disabled)
args["private"] = llx.BoolDataPtr(repo.Private)
Expand Down Expand Up @@ -331,7 +331,7 @@ func (g *mqlGithubRepository) openMergeRequests() ([]interface{}, error) {
"number": llx.IntData(int64(*pr.Number)),
"state": llx.StringDataPtr(pr.State),
"labels": llx.ArrayData(labels, types.Any),
"createdAt": llx.TimeData(pr.CreatedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(pr.CreatedAt)),
"title": llx.StringDataPtr(pr.Title),
"owner": llx.ResourceData(owner, owner.MqlName()),
"assignees": llx.ArrayData(assigneesRes, types.Any),
Expand Down Expand Up @@ -1069,8 +1069,8 @@ func (g *mqlGithubRepository) workflows() ([]interface{}, error) {
"name": llx.StringDataPtr(w.Name),
"path": llx.StringDataPtr(w.Path),
"state": llx.StringDataPtr(w.State),
"createdAt": llx.TimeData(w.CreatedAt.Time),
"updatedAt": llx.TimeData(w.UpdatedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(w.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(w.UpdatedAt)),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -1475,9 +1475,9 @@ func (g *mqlGithubRepository) getIssues(state string) ([]interface{}, error) {
"state": llx.StringData(issue.GetState()),
"body": llx.StringData(issue.GetBody()),
"url": llx.StringData(issue.GetURL()),
"createdAt": llx.TimeData(issue.CreatedAt.Time),
"updatedAt": llx.TimeData(issue.UpdatedAt.Time),
"closedAt": llx.TimeData(issue.ClosedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(issue.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(issue.UpdatedAt)),
"closedAt": llx.TimeDataPtr(githubTimestamp(issue.ClosedAt)),
"assignees": llx.ArrayData(assignees, types.Any),
"closedBy": llx.AnyData(closedBy),
})
Expand Down
4 changes: 2 additions & 2 deletions providers/github/resources/github_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ func (g *mqlGithubUser) gists() ([]interface{}, error) {
r, err := CreateResource(g.MqlRuntime, "github.gist", map[string]*llx.RawData{
"id": llx.StringDataPtr(gist.ID),
"description": llx.StringDataPtr(gist.Description),
"createdAt": llx.TimeData(gist.CreatedAt.Time),
"updatedAt": llx.TimeData(gist.UpdatedAt.Time),
"createdAt": llx.TimeDataPtr(githubTimestamp(gist.CreatedAt)),
"updatedAt": llx.TimeDataPtr(githubTimestamp(gist.UpdatedAt)),
"public": llx.BoolDataPtr(gist.Public),
"owner": llx.ResourceData(g, g.MqlName()),
"files": llx.ArrayData(files, types.Any),
Expand Down

0 comments on commit 16db0ed

Please sign in to comment.