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

Function get_data_rates

chirpstack/src/storage/device.rs:934–952  ·  view source on GitHub ↗
(tenant_id: &Option<Uuid>)

Source from the content-addressed store, hash-verified

932}
933
934pub async fn get_data_rates(tenant_id: &Option<Uuid>) -> Result<Vec<DevicesDataRate>, Error> {
935 let mut q = device::table
936 .inner_join(application::table)
937 .select((
938 device::dr,
939 diesel::dsl::sql::<diesel::sql_types::BigInt>("count(1)"),
940 ))
941 .group_by(device::dr)
942 .filter(device::dr.is_not_null())
943 .into_boxed();
944
945 if let Some(id) = &tenant_id {
946 q = q.filter(application::tenant_id.eq(fields::Uuid::from(id)));
947 }
948
949 q.load(&mut get_async_db_conn().await?)
950 .await
951 .map_err(|e| Error::from_diesel(e, "".into()))
952}
953
954pub async fn get_with_class_b_c_queue_items(limit: usize) -> Result<Vec<Device>> {
955 let mut c = get_async_db_conn().await?;

Callers 1

get_devices_summaryMethod · 0.85

Calls 2

get_async_db_connFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected