Skip to content

Commit

Permalink
Merge pull request #84 from augmentable-dev/nullable-datetimes
Browse files Browse the repository at this point in the history
if a datetime is a zero value, return null
  • Loading branch information
patrickdevivo authored Dec 13, 2020
2 parents c4b68ea + 7f98d45 commit 9385390
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions pkg/ghqlite/pull_requests_vtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,33 @@ func (vc *pullRequestsCursor) Column(c *sqlite3.SQLiteContext, col int) error {
case 11:
c.ResultText(pr.GetActiveLockReason())
case 12:
c.ResultText(pr.GetCreatedAt().Format(time.RFC3339Nano))
t := pr.GetCreatedAt()
if t.IsZero() {
c.ResultNull()
} else {
c.ResultText(t.Format(time.RFC3339Nano))
}
case 13:
c.ResultText(pr.GetUpdatedAt().Format(time.RFC3339Nano))
t := pr.GetUpdatedAt()
if t.IsZero() {
c.ResultNull()
} else {
c.ResultText(t.Format(time.RFC3339Nano))
}
case 14:
c.ResultText(pr.GetClosedAt().Format(time.RFC3339Nano))
t := pr.GetClosedAt()
if t.IsZero() {
c.ResultNull()
} else {
c.ResultText(t.Format(time.RFC3339Nano))
}
case 15:
c.ResultText(pr.GetMergedAt().Format(time.RFC3339Nano))
t := pr.GetMergedAt()
if t.IsZero() {
c.ResultNull()
} else {
c.ResultText(t.Format(time.RFC3339Nano))
}
case 16:
c.ResultText(pr.GetMergeCommitSHA())
case 17:
Expand Down

0 comments on commit 9385390

Please sign in to comment.