#![cfg(all(
feature = "inbox",
feature = "sqlite",
feature = "chrono",
feature = "json",
feature = "testing"
))]
#[path = "../live/mod.rs"]
mod live;
mod advisory;
mod flat_payload;
mod headers_layout;
mod row_mode;
use std::time::Duration;
use ruststream_sqlx::SqlxBroker;
use sqlx::{AssertSqlSafe, Sqlite, SqlitePool};
use live::Database;
const POLL: Duration = Duration::from_millis(20);
const SETTLED: Duration = Duration::from_millis(400);
async fn database(schema: &'static str) -> Database<Sqlite> {
let db = live::sqlite::database()
.await
.expect("the SQLite stand runs in process");
sqlx::raw_sql(AssertSqlSafe(schema))
.execute(&db.pool)
.await
.expect("the scenario's tables apply");
db
}
fn broker(pool: &SqlitePool) -> SqlxBroker<Sqlite> {
SqlxBroker::new(pool.clone()).poll_interval(POLL)
}
async fn count(pool: &SqlitePool, sql: &'static str) -> i64 {
sqlx::query_scalar(sql)
.fetch_one(pool)
.await
.expect("the table reads")
}