Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalization of dates in responses from query command #51

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

johnerikhalse
Copy link
Contributor

@johnerikhalse johnerikhalse commented Jul 26, 2023

The command veidemannctl report query allows to write raw RethinkDb queries to Veidemanns config database.
When such a query returns a structure containing a date element, it is formatted as it is represented in RethinkDb like this:

{
  "dateTime":{
    "date":{
      "year":2019,
      "month":2,
      "day":21
    },
    "time":{
      "hour":13,
      "minute":29,
      "second":55,
      "nano":324000000
    }
  },
  "offset":{
    "totalSeconds":0
  }
}

When the database is accessed with the regular get/set update commands, the format defined by RFC3339 is used. This PR detects RethinkDb dates in query responses and converts them to RFC3339 format.

@johnerikhalse johnerikhalse added the enhancement New feature or request label Jul 26, 2023
@johnerikhalse johnerikhalse marked this pull request as ready for review July 26, 2023 13:44
Copy link
Contributor

@trym-b trym-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description looks good to me, perhaps add it to the commit message for increased discoverability?

Since this PR fixes a regression if I recall correctly, is it possible to add a test so we avoid ending up in the same state later?

format/formatter.go Outdated Show resolved Hide resolved
format/JsonFormatter.go Show resolved Hide resolved
format/formatter.go Outdated Show resolved Hide resolved
format/formatter.go Outdated Show resolved Hide resolved
@johnerikhalse johnerikhalse force-pushed the date-parsing branch 3 times, most recently from e1d1897 to 6670b4f Compare July 31, 2023 11:51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rename to query-template.yaml

@johnerikhalse johnerikhalse merged commit 3af42e6 into master Aug 21, 2023
@johnerikhalse johnerikhalse deleted the date-parsing branch August 21, 2023 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants