async_sqlx_session/
lib.rs

1/*!
2# async-sqlx-session
3
4This crate currently provides several session stores, each of which is
5enabled by a feature flag.
6
7* To use [`SqliteSessionStore`], enable the `sqlite` feature on this
8crate.
9* To use [`PostgresSessionStore`], enable the `pg` feature on this
10crate.
11* To use [`MysqlSessionStore`], enable the `mysql` feature on this
12crate.
13
14To use the `spawn_cleanup_task` function for either store on
15async-std, enable the `async_std` feature. To perform session cleanup
16intermittently with a different runtime, use a function like:
17
18```rust,ignore
19fn clean_up_intermittently(store: &SqliteSessionStore, period: Duration) {
20    let store = store.clone();
21    other_runtime::spawn(async move {
22        loop {
23            other_runtime::sleep(period).await;
24            if let Err(error) = store.cleanup().await {
25                log::error!("cleanup error: {}", error);
26            }
27        }
28    });
29}
30```
31*/
32
33#![forbid(unsafe_code, future_incompatible)]
34#![deny(
35    missing_debug_implementations,
36    nonstandard_style,
37    missing_docs,
38    unreachable_pub,
39    missing_copy_implementations,
40    unused_qualifications
41)]
42
43#[cfg(feature = "sqlite")]
44mod sqlite;
45#[cfg(feature = "sqlite")]
46pub use sqlite::SqliteSessionStore;
47
48#[cfg(feature = "pg")]
49mod pg;
50#[cfg(feature = "pg")]
51pub use pg::PostgresSessionStore;
52
53#[cfg(feature = "mysql")]
54mod mysql;
55#[cfg(feature = "mysql")]
56pub use mysql::MySqlSessionStore;