Skip to main content
Version: 0.11.x

Database & Async Runtime

First of all, please star our GitHub repo! Your support is vital to the continued maintenance of SeaORM.

Then, add sea-orm to the [dependencies] section of your Cargo.toml.

Cargo.toml
sea-orm = { version = "^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 MariaDB
  • sqlx-postgres - SQLx PostgreSQL
  • sqlx-sqlite - SQLx SQLite

See also: SQLx docs.

ASYNC_RUNTIME

You have to choose one from:

runtime-actix-native-tls, runtime-async-std-native-tls, runtime-tokio-native-tls, runtime-actix-rustls, runtime-async-std-rustls, runtime-tokio-rustls

Basically, they are in the form of runtime-ASYNC_RUNTIME-TLS_LIB:

  1. Choose the ASYNC_RUNTIME corresponding to your Rust web framework:
ASYNC_RUNTIMEWeb Framework
actixActix
async-stdTide
tokioAxum, Rocket, Poem
  1. native-tls uses the platform's native security facilities, while rustls is a pure Rust implementation.

Extra features

  • debug-print - print every SQL statement to logger
  • mock - mock interface for unit testing
  • macros - procedural macros for your convenient
  • with-chrono - support chrono types
  • with-time - support time types
  • with-json - support serde-json types
  • with-rust_decimal - support rust_decimal types
  • with-bigdecimal - support bigdecimal types
  • with-uuid - support uuid types
  • postgres-array - support array types in Postgres
  • sea-orm-internal - opt-in unstable internal APIs (for accessing re-export SQLx types)