(
txn: &'a DatabaseTransaction,
name1: &'a str,
name2: &'a str,
search_name: &'a str,
)
| 63 | } |
| 64 | |
| 65 | fn _transaction_with_reference<'a>( |
| 66 | txn: &'a DatabaseTransaction, |
| 67 | name1: &'a str, |
| 68 | name2: &'a str, |
| 69 | search_name: &'a str, |
| 70 | ) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<(), DbErr>> + Send + 'a>> { |
| 71 | Box::pin(async move { |
| 72 | let _ = bakery::ActiveModel { |
| 73 | name: Set(name1.to_owned()), |
| 74 | profit_margin: Set(10.4), |
| 75 | ..Default::default() |
| 76 | } |
| 77 | .save(txn) |
| 78 | .await?; |
| 79 | |
| 80 | let _ = bakery::ActiveModel { |
| 81 | name: Set(name2.to_owned()), |
| 82 | profit_margin: Set(15.0), |
| 83 | ..Default::default() |
| 84 | } |
| 85 | .save(txn) |
| 86 | .await?; |
| 87 | |
| 88 | let bakeries = Bakery::find() |
| 89 | .filter(bakery::Column::Name.contains(search_name)) |
| 90 | .all(txn) |
| 91 | .await?; |
| 92 | |
| 93 | assert_eq!(bakeries.len(), 2); |
| 94 | |
| 95 | Ok(()) |
| 96 | }) |
| 97 | } |
| 98 | |
| 99 | #[sea_orm_macros::test] |
| 100 | pub async fn transaction_begin_out_of_scope() -> Result<(), DbErr> { |
no test coverage detected