cargo fmt
This commit is contained in:
parent
4d0c5f0b0f
commit
333f199c1a
@ -23,7 +23,9 @@ impl ExecResult {
|
||||
#[cfg(feature = "sqlx-mysql")]
|
||||
ExecResultHolder::SqlxMySql(result) => result.last_insert_id(),
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
ExecResultHolder::SqlxPostgres(_) => panic!("Should not retrieve last_insert_id this way"),
|
||||
ExecResultHolder::SqlxPostgres(_) => {
|
||||
panic!("Should not retrieve last_insert_id this way")
|
||||
}
|
||||
#[cfg(feature = "sqlx-sqlite")]
|
||||
ExecResultHolder::SqlxSqlite(result) => {
|
||||
let last_insert_rowid = result.last_insert_rowid();
|
||||
|
@ -89,15 +89,13 @@ where
|
||||
let res = conn.query_one(statement).await?.unwrap();
|
||||
res.try_get("", "last_insert_id").unwrap_or_default()
|
||||
}
|
||||
_ => {
|
||||
db.execute(statement).await?
|
||||
_ => db
|
||||
.execute(statement)
|
||||
.await?
|
||||
.last_insert_id()
|
||||
.to_string()
|
||||
.parse()
|
||||
.unwrap_or_default()
|
||||
},
|
||||
.unwrap_or_default(),
|
||||
};
|
||||
Ok(InsertResult {
|
||||
last_insert_id,
|
||||
})
|
||||
Ok(InsertResult { last_insert_id })
|
||||
}
|
||||
|
@ -130,11 +130,10 @@ pub async fn test_update_deleted_customer(db: &DbConn) {
|
||||
|
||||
assert_eq!(Customer::find().count(db).await.unwrap(), init_n_customers);
|
||||
|
||||
let customer: Option<customer::Model> =
|
||||
Customer::find_by_id(customer_id.clone().unwrap())
|
||||
.one(db)
|
||||
.await
|
||||
.expect("could not find customer");
|
||||
let customer: Option<customer::Model> = Customer::find_by_id(customer_id.clone().unwrap())
|
||||
.one(db)
|
||||
.await
|
||||
.expect("could not find customer");
|
||||
|
||||
assert_eq!(customer, None);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user