pub struct AggregationRequest {
pub aggregate_by: HashMap<String, Value>,
pub group_by: Vec<String>,
pub filter: Option<Value>,
pub limit: usize,
}Expand description
Request for aggregation query (Turbopuffer-inspired)
Fields§
§aggregate_by: HashMap<String, Value>Named aggregations to compute Example: {“my_count”: [“Count”], “total_score”: [“Sum”, “score”]}
group_by: Vec<String>Fields to group results by (optional) Example: [“category”, “status”]
filter: Option<Value>Filter to apply before aggregation
limit: usizeMaximum number of groups to return (default: 100)
Implementations§
Source§impl AggregationRequest
impl AggregationRequest
Sourcepub fn with_count(self, name: impl Into<String>) -> Self
pub fn with_count(self, name: impl Into<String>) -> Self
Add a count aggregation
Sourcepub fn with_sum(self, name: impl Into<String>, field: impl Into<String>) -> Self
pub fn with_sum(self, name: impl Into<String>, field: impl Into<String>) -> Self
Add a sum aggregation
Sourcepub fn with_avg(self, name: impl Into<String>, field: impl Into<String>) -> Self
pub fn with_avg(self, name: impl Into<String>, field: impl Into<String>) -> Self
Add an average aggregation
Sourcepub fn with_min(self, name: impl Into<String>, field: impl Into<String>) -> Self
pub fn with_min(self, name: impl Into<String>, field: impl Into<String>) -> Self
Add a min aggregation
Sourcepub fn with_max(self, name: impl Into<String>, field: impl Into<String>) -> Self
pub fn with_max(self, name: impl Into<String>, field: impl Into<String>) -> Self
Add a max aggregation
Sourcepub fn with_group_by(self, field: impl Into<String>) -> Self
pub fn with_group_by(self, field: impl Into<String>) -> Self
Add a single group by field
Sourcepub fn with_filter(self, filter: Value) -> Self
pub fn with_filter(self, filter: Value) -> Self
Set filter for aggregation
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Set maximum number of groups to return
Trait Implementations§
Source§impl Clone for AggregationRequest
impl Clone for AggregationRequest
Source§fn clone(&self) -> AggregationRequest
fn clone(&self) -> AggregationRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AggregationRequest
impl Debug for AggregationRequest
Source§impl Default for AggregationRequest
impl Default for AggregationRequest
Source§impl<'de> Deserialize<'de> for AggregationRequest
impl<'de> Deserialize<'de> for AggregationRequest
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 AggregationRequest
impl RefUnwindSafe for AggregationRequest
impl Send for AggregationRequest
impl Sync for AggregationRequest
impl Unpin for AggregationRequest
impl UnsafeUnpin for AggregationRequest
impl UnwindSafe for AggregationRequest
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