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