Database & Async Runtime
We need your support! ⭐
Thank you for using SeaORM. Please star our GitHub repo! Your support is vital to the continued development and maintenance of SeaORM.
First, add sea-orm
to the [dependencies]
section of Cargo.toml
.
Cargo.toml
sea-orm = { version = "1.0.0", features = [ <DATABASE_DRIVER>, <ASYNC_RUNTIME>, "macros" ] }
You must choose a DATABASE_DRIVER
and an ASYNC_RUNTIME
. macros
is needed if you use SeaORM's generated entities (most likely).
DATABASE_DRIVER
You can choose one or more from:
sqlx-mysql
- SQLx MySQL and MariaDBsqlx-postgres
- SQLx PostgreSQLsqlx-sqlite
- SQLx SQLite
See also: SQLx docs.
SQL Server (MSSQL) backend
The installation and configuration of MSSQL driver can be found here.
ASYNC_RUNTIME
You have to choose one from:
runtime-async-std-native-tls
, runtime-tokio-native-tls
, runtime-async-std-rustls
, runtime-tokio-rustls
Basically, they are in the form of runtime-ASYNC_RUNTIME-TLS_LIB
:
ASYNC_RUNTIME
can beasync-std
ortokio
TLS_LIB
can either benative-tls
orrustls
- Choose the ASYNC_RUNTIME corresponding to your Rust web framework:
ASYNC_RUNTIME | Web Framework |
---|---|
async-std | Tide |
tokio | Axum , Actix , Poem , Rocket |
native-tls
uses the platform's native security facilities, whilerustls
is an (almost) pure Rust implementation.
Extra features
debug-print
- print every SQL statement to loggermock
- mock interface for unit testingmacros
- procedural macros for your convenientwith-chrono
- supportchrono
typeswith-time
- supporttime
typeswith-json
- supportserde-json
typeswith-rust_decimal
- supportrust_decimal
typeswith-bigdecimal
- supportbigdecimal
typeswith-uuid
- supportuuid
typespostgres-array
- support array types in Postgres (automatically enabled whensqlx-postgres
feature is turned on)sea-orm-internal
- opt-in unstable internal APIs (for accessing re-export SQLx types)