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

[Mobile Config] Add device_types filter to stream_gateways_info #880

Merged
merged 13 commits into from
Oct 28, 2024

Conversation

kurotych
Copy link
Member

No description provided.

@kurotych kurotych changed the title Gateway info stream filtered [Mobile Config] Add device_types filter to stream_gateways_info Oct 24, 2024
@kurotych kurotych marked this pull request as ready for review October 24, 2024 06:25
tracing::debug!("fetching all gateways' info");
tracing::debug!(
"fetching all gateways' info. Device types: {:?} ",
request.device_types
Copy link
Contributor

Choose a reason for hiding this comment

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

should this debug statement come after the map below? it would debug to a vec of i32s before that conversion, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Fixed

mobile_config/src/gateway_info.rs Outdated Show resolved Hide resolved
.bind(
device_types
.iter()
.map(|v| format!("\"{}\"", v))
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume the escaping here is required ? A note to explain why would be useful for future readers, especially given the table schema is managed outside of the oracles

Copy link
Member Author

@kurotych kurotych Oct 25, 2024

Choose a reason for hiding this comment

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

The device_types field has a jsonb type but is being used as a string, which forces us to add quotes.
image


image

Column in "meta" database:
image

(Added comment to code)

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure it is a better idea but you can query the field normally like this
WHERE mhi.device_type #>> '{}' = 'wifiDataOnly'

@kurotych kurotych merged commit 062e5d4 into main Oct 28, 2024
17 checks passed
@kurotych kurotych deleted the gateway_info_stream_filtered branch October 28, 2024 18:16
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.

4 participants