pub trait AimDbQueryExt {
// Required methods
fn query_latest<T: DeserializeOwned>(
&self,
record_pattern: &str,
limit_per_record: usize,
) -> BoxFuture<'_, Result<Vec<T>, PersistenceError>>;
fn query_range<T: DeserializeOwned>(
&self,
record_pattern: &str,
start_ts: u64,
end_ts: u64,
limit_per_record: Option<usize>,
) -> BoxFuture<'_, Result<Vec<T>, PersistenceError>>;
fn query_raw(
&self,
record_pattern: &str,
params: QueryParams,
) -> BoxFuture<'_, Result<Vec<StoredValue>, PersistenceError>>;
}Expand description
Extension trait that adds persistence query methods to AimDb.
Import use aimdb_persistence::AimDbQueryExt; to call .query_latest() /
.query_range() on a live AimDb<R> handle.
Required Methods§
Sourcefn query_latest<T: DeserializeOwned>(
&self,
record_pattern: &str,
limit_per_record: usize,
) -> BoxFuture<'_, Result<Vec<T>, PersistenceError>>
fn query_latest<T: DeserializeOwned>( &self, record_pattern: &str, limit_per_record: usize, ) -> BoxFuture<'_, Result<Vec<T>, PersistenceError>>
Query the latest N values per matching record.
Pattern support: "accuracy::*" returns latest N from each matching
record. Single record: "accuracy::vienna" returns latest N from that
record only.
Rows that fail to deserialize as T are skipped with a tracing
warning rather than failing the entire query.
Sourcefn query_range<T: DeserializeOwned>(
&self,
record_pattern: &str,
start_ts: u64,
end_ts: u64,
limit_per_record: Option<usize>,
) -> BoxFuture<'_, Result<Vec<T>, PersistenceError>>
fn query_range<T: DeserializeOwned>( &self, record_pattern: &str, start_ts: u64, end_ts: u64, limit_per_record: Option<usize>, ) -> BoxFuture<'_, Result<Vec<T>, PersistenceError>>
Query values within a time range for a single record or pattern.
Pass None for limit_per_record to return all matching rows, or
Some(n) to cap results per matching record name.
Rows that fail to deserialize as T are skipped with a tracing
warning.
Sourcefn query_raw(
&self,
record_pattern: &str,
params: QueryParams,
) -> BoxFuture<'_, Result<Vec<StoredValue>, PersistenceError>>
fn query_raw( &self, record_pattern: &str, params: QueryParams, ) -> BoxFuture<'_, Result<Vec<StoredValue>, PersistenceError>>
Query raw stored values (untyped, returns JSON).
This is the non-generic variant used by the AimX record.query handler
which doesn’t know the concrete Rust type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.