9 unstable releases (4 breaking)
0.5.1 | May 3, 2024 |
---|---|
0.5.0 | May 1, 2024 |
0.4.0 | Apr 30, 2024 |
0.3.0 | Jan 7, 2024 |
0.1.0 | Feb 8, 2023 |
#537 in Database interfaces
471 downloads per month
19KB
287 lines
poem-sea-orm-middleware
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–33MB
~503K SLoC