MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / _transaction_with_reference

Function _transaction_with_reference

tests/transaction_tests.rs:65–97  ·  view source on GitHub ↗
(
    txn: &'a DatabaseTransaction,
    name1: &'a str,
    name2: &'a str,
    search_name: &'a str,
)

Source from the content-addressed store, hash-verified

63}
64
65fn _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]
100pub async fn transaction_begin_out_of_scope() -> Result<(), DbErr> {

Callers 1

Calls 4

saveMethod · 0.80
filterMethod · 0.80
containsMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected