tablo_core/db.rs
1//! The `Db` glue: how Tablo code reaches the pooled Toasty database.
2
3use toasty::Db;
4use topcoat::context::{Cx, app_context};
5
6/// Returns the pooled [`Db`] registered on the app context.
7///
8/// Never runs statements on another handle while a transaction holds its connection; drains or
9/// drops streaming list bodies before the next query.
10#[inline]
11pub fn db(cx: &Cx) -> Db {
12 app_context::<Db>(cx).clone()
13}
14
15#[cfg(test)]
16mod tests;