Skip to main content

Crate tower_sessions_toasty_store

Crate tower_sessions_toasty_store 

Source
Expand description

Toasty session store for tower-sessions.

One store implementation, many backends: SQLite, PostgreSQL, MySQL, and Turso — the store uses only portable Toasty query-builder calls, so every SQL backend shares the same code path. DynamoDB is untested and not supported.

§Usage

With a store-owned database (the store builds its own toasty::Db):

use tower_sessions_toasty_store::ToastyStore;

let store = ToastyStore::connect("sqlite::memory:").await.unwrap();
store.migrate().await.unwrap();

With an application-owned toasty::Db, sharing its connection pool. The Db must register TowerSession — using an unregistered model panics inside Toasty:

use tower_sessions_toasty_store::{ToastyStore, TowerSession};

let db = toasty::Db::builder()
    // your own models join the list: toasty::models!(TowerSession, crate::*)
    .models(toasty::models!(TowerSession))
    .connect("sqlite::memory:")
    .await
    .unwrap();
let store = ToastyStore::new(db);
store.migrate().await.unwrap();

Re-exports§

pub use toasty;

Structs§

ToastyStore
A Toasty session store.
TowerSession
The session model, mapped to the tower_sessions table.

Enums§

ToastyStoreError
An error type for Toasty stores.