async-sea-orm-session

Latest version crates.io downloads Build Status Apache/MIT2.0 License

An async-session backend implemented using sea-orm, heavily inspired by async-sqlx-session.

More information can be found in the crate documentation.

Basic usage

In the following example we create a DatabaseSessionStore, which implements the SessionStore trait from async-session.

```rust use asyncseaormsession::migration::Migrator; use asyncseaormsession::DatabaseSessionStore; use seaorm::{Database, DatabaseConnection}; use seaorm_migration::MigratorTrait;

[tokio::main]

async fn main() -> Result<(), seaorm::DbErr> { // Create a seaorm::DatabaseConnection in the usual way. let db: DatabaseConnection = Database::connect("protocol://username:password@host/database").await?;

// Run the async_sea_orm_session migration to create the session table.
Migrator::up(&db, None).await?;

// Finally create a DatabaseSessionStore that implements SessionStore.
let store = DatabaseSessionStore::new(db);
Ok(())

} ```

Examples

TODO

License

Licensed under either of * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.