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

poem-sea-orm-middleware

Sea ORM middleware for Poem web framework

13 releases (6 breaking)

0.7.1 Sep 24, 2024
0.6.0 Aug 3, 2024
0.5.2 May 22, 2024
0.3.0 Jan 7, 2024
0.2.3 Mar 27, 2023

#602 in Database interfaces

38 downloads per month

MIT/Apache

19KB
370 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

~19–30MB
~446K SLoC