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

Add epoch time macros #22

Merged
merged 1 commit into from
Dec 4, 2020
Merged

Add epoch time macros #22

merged 1 commit into from
Dec 4, 2020

Conversation

marcusolsson
Copy link
Contributor

This PR adds macro support for custom query params and JSON Path queries:

  • $__unixEpochFrom() is substituted with the start of the time interval in Unix epoch (seconds)
  • $__unixEpochTo() is substituted with the end of the time interval in Unix epoch (seconds)

Example:

The following JSON Path query:

$.items[?(@.created_at > $__unixEpochFrom() && @.created_at < $__unixEpochTo())].name

gets expanded into

$.items[?(@.created_at > 1607006005 && @.created_at < 1607017003)].name

Same thing for query parameters:

from=$__unixEpochFrom()&to=$__unixEpochTo()

becomes

from=1607006005&to=1607017003

Closes #17

@marcusolsson marcusolsson merged commit a1c644a into master Dec 4, 2020
@marcusolsson marcusolsson deleted the epoch-time-macros branch January 8, 2021 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time selection macros in query parameters
1 participant