pub struct AnalyticsQuery {
pub collection: String,
pub metric: MetricSpec,
pub filter: Option<Value>,
}Expand description
The full analytics query sent from the dashboard.
Example JSON (what the dashboard sends):
{
"collection": "events",
"metric": { "type": "COUNT" },
"where": { "event_type": "button_click" }
}The #[derive(Debug, Deserialize)] annotation tells Rust to:
Debug: allow printing this struct with{:?}for debugging.Deserialize: automatically parse it from JSON using serde.
Fields§
§collection: StringThe name of the collection to query (e.g. “events”, “users”).
metric: MetricSpecWhich metric to compute (COUNT, SUM, AVG, MIN, MAX).
filter: Option<Value>Optional filter — only documents matching this WHERE clause are included.
The #[serde(rename = "where")] tells serde to look for the JSON key
“where” (not “filter”) when deserializing. “where” is a reserved keyword
in Rust, so we can’t use it as a field name directly.
Trait Implementations§
Source§impl Debug for AnalyticsQuery
impl Debug for AnalyticsQuery
Source§impl<'de> Deserialize<'de> for AnalyticsQuery
impl<'de> Deserialize<'de> for AnalyticsQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AnalyticsQuery
impl RefUnwindSafe for AnalyticsQuery
impl Send for AnalyticsQuery
impl Sync for AnalyticsQuery
impl Unpin for AnalyticsQuery
impl UnsafeUnpin for AnalyticsQuery
impl UnwindSafe for AnalyticsQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more