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

allow map params #155

Merged
merged 2 commits into from Apr 4, 2024
Merged

allow map params #155

merged 2 commits into from Apr 4, 2024

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Apr 3, 2024

This PR allows passing map as params, e.g.

site_ids = [1, 2, 3]
site_ids_with_tzs = %{1 => "UTC", 2 => "Europe/Vienna", 3 => "Asia/Taipei"}

from e in "events",
  where: e.site_id in ^site_ids and e.timestamp >= ^0 and e.timestamp <= ^1,
  group_by: [e.site_id, selected_as(:bucket)],
  select: %{
    site_id: e.site_id,
    bucket: selected_as(fragment("toStartOfHour(toTimeZone(timestamp, ?[site_id]))", ^site_ids_with_tzs), :bucket),
    count: fragment("count()")
  }

@ruslandoga ruslandoga merged commit 73e5644 into master Apr 4, 2024
9 checks passed
@ruslandoga ruslandoga deleted the allow-map-params branch April 4, 2024 07:15
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.

None yet

1 participant