Add sql transactions
This commit is contained in:
parent
455ca50695
commit
9823511b62
9 changed files with 171 additions and 138 deletions
src
|
@ -28,11 +28,11 @@ async fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
let pool = emgauwa_common::db::init(&settings.database).await?;
|
||||
|
||||
let mut conn = pool.acquire().await.map_err(EmgauwaError::from)?;
|
||||
DbController::all_inactive(&mut conn)
|
||||
let mut tx = pool.begin().await.map_err(EmgauwaError::from)?;
|
||||
DbController::all_inactive(&mut tx)
|
||||
.await
|
||||
.map_err(EmgauwaError::from)?;
|
||||
conn.close().await.map_err(EmgauwaError::from)?;
|
||||
tx.commit().await.map_err(EmgauwaError::from)?;
|
||||
|
||||
let app_state_arbiter = Arbiter::with_tokio_rt(|| {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue