[Rust SeaORM FAQs] SeaORM integrate Rocket support
sea-orm-rocket
sea-orm-rocket
is the crate for SeaORM integrate Rocket support.
SeaORM is a relational ORM to help you build light weight and concurrent web services in Rust
Rocket is a web framework for Rust. If youโd like, you can think of Rocket as being a more flexible, friendly medley of Rails - https://rubyonrails.org/, Flask - https://palletsprojects.com/p/flask/, Bottle - https://bottlepy.org/docs/dev/index.html, and Yesod - https://www.yesodweb.com/. We prefer to think of Rocket as something new. Rocket aims to be fast, easy, and flexible while offering guaranteed safety and security where it can. Importantly, Rocket also aims to be fun, and it accomplishes this by ensuring that you write as little code as needed to accomplish your task.
Usages
Download
1 | git clone [email protected]:SeaQL/sea-orm.git |
Config Database
Replace url
with your prefered Database url.
1 | # Rocket.toml |
Cargo Run
1 | cargo run |
Then, ๐ Rocket has launched from http://127.0.0.1:8000
.
See sea-orm/examples/rocket_example at master ยท SeaQL/sea-orm - https://github.com/SeaQL/sea-orm/tree/master/examples/rocket_example to learn more.
FAQs
perhaps two different versions of crate rocket
are being used?
1 | error[E0308]: mismatched types |
Remember to make rocket
and sea-orm
compatible.
1 | # Cargo.toml |
the trait Clone
is not implemented for DatabaseConnection
1 | 11 | pub struct SeaOrmPool { |
Check DatabaseConnection
source code:
1 | // sea-orm/src/database/db_connection.rs |
Remember to disable mock
feature to enable derive(Clone)
for DatabaseConnection
.
1 | # Cargo.toml |
References
[3] SeaORM - ๐ An async & dynamic ORM for Rust - https://www.sea-ql.org/SeaORM/
[4] SeaQL/sea-orm: ๐ An async & dynamic ORM for Rust - https://github.com/SeaQL/sea-orm
[5] Getting Started - Rocket Programming Guide - https://rocket.rs/v0.5-rc/guide/getting-started/
[6] Rocket - Simple, Fast, Type-Safe Web Framework for Rust - https://rocket.rs/