use sqlx::{sqlite::Sqlite, SqliteConnection, Transaction}; pub trait Provider { fn setup(&mut self) -> Setup; } impl<'c> Provider for Transaction<'c, Sqlite> { fn setup(&mut self) -> Setup { Setup(self) } } pub struct Setup<'t>(&'t mut SqliteConnection); impl<'c> Setup<'c> { pub async fn completed(&mut self) -> Result { let completed = sqlx::query_scalar!( r#" select count(*) > 0 as "completed: bool" from login "#, ) .fetch_one(&mut *self.0) .await?; Ok(completed) } }