MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / get_measurement_keys

Function get_measurement_keys

chirpstack/src/storage/application.rs:593–613  ·  view source on GitHub ↗
(application_id: &Uuid)

Source from the content-addressed store, hash-verified

591
592#[cfg(feature = "postgres")]
593pub async fn get_measurement_keys(application_id: &Uuid) -> Result<Vec<String>, Error> {
594 let keys: Vec<Measurement> = diesel::sql_query(
595 r#"
596 select
597 distinct jsonb_object_keys(dp.measurements) as key
598 from
599 device_profile dp
600 inner join device d
601 on d.device_profile_id = dp.id
602 where
603 d.application_id = $1
604 order by
605 key
606 "#,
607 )
608 .bind::<fields::sql_types::Uuid, _>(fields::Uuid::from(application_id))
609 .load(&mut get_async_db_conn().await?)
610 .await
611 .map_err(|e| Error::from_diesel(e, application_id.to_string()))?;
612 Ok(keys.iter().map(|k| k.key.clone()).collect())
613}
614
615#[cfg(feature = "sqlite")]
616pub async fn get_measurement_keys(application_id: &Uuid) -> Result<Vec<String>, Error> {

Callers 1

getMethod · 0.85

Calls 3

to_stringMethod · 0.80
iterMethod · 0.80
get_async_db_connFunction · 0.70

Tested by

no test coverage detected