//! Counting the SQL a piece of code runs, e.g. to catch an N+1 in a test.
use Future;
use ;
task_local!
/// Notes a statement if someone is capturing.
pub
/// Runs `fut` and returns its output with the SQL statements it ran, in
/// order: queries in this task, including requests sent through `TestApp`
/// (not jobs run by workers or anything `tokio::spawn`ed).
///
/// ```
/// # use renox::prelude::*;
/// # async fn demo(app: renox::testing::TestApp) {
/// let (page, queries) = renox::db::capture_queries(app.get("/posts")).await;
/// page.assert_ok();
/// assert!(queries.len() <= 3, "N+1? {queries:#?}");
/// # }
/// ```
pub async