Skip to content

Commit

Permalink
aggregated query example update
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Apr 2, 2024
1 parent c669587 commit 2e07d87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/aggregated-query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn config_env_var(name: &str) -> Result<String, String> {
struct MyAggTestStructure {
counter: usize,
calc_sum: Option<usize>,
calc_avg: Option<usize>,
calc_avg: Option<f64>,
}

#[tokio::main]
Expand All @@ -35,8 +35,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
.aggregate(|a| {
a.fields([
a.field(path!(MyAggTestStructure::counter)).count(),
//a.field(path!(MyAggTestStructure::calc_sum)).sum("some_num"), // Not supported/enabled yet by Firestore, exists only on proto level
//a.field(path!(MyAggTestStructure::calc_avg)).avg("some_num"),
a.field(path!(MyAggTestStructure::calc_sum)).sum("some_num"),
a.field(path!(MyAggTestStructure::calc_avg)).avg("some_num"),
])
})
.obj()
Expand Down

0 comments on commit 2e07d87

Please sign in to comment.