#sea-orm #poem-web #poem #middleware #web #web-framework

poem-sea-orm-middleware

Sea ORM middleware for Poem web framework

10 unstable releases (4 breaking)

0.5.2 May 22, 2024
0.5.1 May 3, 2024
0.4.0 Apr 30, 2024
0.3.0 Jan 7, 2024
0.1.0 Feb 8, 2023

#605 in Database interfaces

Download history 144/week @ 2024-02-26 38/week @ 2024-03-04 28/week @ 2024-03-11 34/week @ 2024-03-18 28/week @ 2024-03-25 40/week @ 2024-04-01 1/week @ 2024-04-22 463/week @ 2024-04-29 7/week @ 2024-05-06 202/week @ 2024-05-20 4/week @ 2024-05-27 5/week @ 2024-06-03 6/week @ 2024-06-10

217 downloads per month

MIT/Apache

19KB
285 lines

poem-sea-orm-middleware

Crates.io version

This library is the Sea ORM middleware for Poem. This library is designed to make it easier for users to no longer need to manually begin transactions.

Example

#[handler]
async fn hello(Path(name): Path<String>) -> String {
    // get transaction from task local
    let txn = default_txn().await.unwrap();

    let user = match Entity::find()
        .filter(Column::Name.eq(name.clone()))
        .one(&txn)
        .await
        .unwrap()
    {
        Some(user) => user,
        None => return format!("not found: {name}"),
    };

    format!("hello: {}", user.name)
}

Check examples, to see the full examples.

Dependencies

~18–31MB
~470K SLoC