Skip to content

Commit d0b5f6d

Browse files
committed
updates for async-sessions-v4
1 parent 06a3abb commit d0b5f6d

File tree

8 files changed

+279
-326
lines changed

8 files changed

+279
-326
lines changed

.cargo/config.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[env]
2+
RUST_TEST_THREADS = "1"

.github/workflows/ci.yaml

+3-10
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,23 @@ jobs:
5757
toolchain: ${{ matrix.rust }}
5858
override: true
5959

60-
- name: check avoid-dev-deps
61-
uses: actions-rs/cargo@v1
62-
if: matrix.rust == 'nightly'
63-
with:
64-
command: check
65-
args: --all -Z avoid-dev-deps
66-
6760
- name: pg tests
6861
uses: actions-rs/cargo@v1
6962
with:
7063
command: test
71-
args: --all --features pg,async_std -- --test-threads=1
64+
args: --all --features pg -- --test-threads=1
7265

7366
- name: sqlite tests
7467
uses: actions-rs/cargo@v1
7568
with:
7669
command: test
77-
args: --all --features sqlite,async_std
70+
args: --all --features sqlite
7871

7972
- name: mysql tests
8073
uses: actions-rs/cargo@v1
8174
with:
8275
command: test
83-
args: --all --features mysql,async_std -- --test-threads=1
76+
args: --all --features mysql -- --test-threads=1
8477

8578
check_fmt_and_docs:
8679
name: Checking fmt, clippy, and docs

Cargo.toml

+11-7
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ keywords = ["sessions", "sqlx", "sqlite", "postgres", "mysql"]
1212
categories = ["web-programming::http-server", "web-programming", "database"]
1313

1414
[package.metadata.docs.rs]
15-
features = ["pg", "sqlite", "mysql", "async_std"]
15+
features = ["pg", "sqlite", "mysql"]
1616

1717
[features]
18-
default = ["native-tls"]
18+
default = []
1919
sqlite = ["sqlx/sqlite"]
2020
pg = ["sqlx/postgres", "sqlx/json"]
2121
native-tls = ["sqlx/runtime-async-std-native-tls"]
2222
rustls = ["sqlx/runtime-async-std-rustls"]
23-
async_std = ["async-std"]
2423
mysql = ["sqlx/mysql", "sqlx/json"]
2524

2625
[dependencies]
27-
async-session = "3.0.0"
28-
sqlx = { version = "0.6.2", features = ["chrono"] }
29-
async-std = { version = "1.12.0", optional = true }
26+
async-session = { git = "https://github.com/http-rs/async-session", branch = "overhaul-session-and-session-store", default-features = false }
27+
sqlx = { version = "0.6.2", features = ["time"] }
28+
log = "0.4.17"
29+
serde_json = "1.0.93"
30+
serde = "1.0.152"
31+
thiserror = "1.0.38"
32+
time = "0.3.18"
33+
base64 = "0.21.0"
3034

3135
[dev-dependencies]
3236
async-std = { version = "1.12.0", features = ["attributes"] }
3337

3438
[dev-dependencies.sqlx]
3539
version = "0.6.2"
36-
features = ["chrono", "runtime-async-std-native-tls"]
40+
features = ["runtime-async-std-native-tls"]

src/error.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// Errors that can arise in the operation of the session stores
2+
/// included in this crate
3+
#[derive(thiserror::Error, Debug)]
4+
#[non_exhaustive]
5+
pub enum Error {
6+
/// an error that comes from sqlx
7+
#[error(transparent)]
8+
SqlxError(#[from] sqlx::Error),
9+
10+
/// an error that comes from serde_json
11+
#[error(transparent)]
12+
SerdeJson(#[from] serde_json::Error),
13+
14+
/// an error that comes from base64
15+
#[error(transparent)]
16+
Base64(#[from] base64::DecodeError),
17+
}

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ pub use pg::PostgresSessionStore;
5454
mod mysql;
5555
#[cfg(feature = "mysql")]
5656
pub use mysql::MySqlSessionStore;
57+
58+
mod error;
59+
pub use error::Error;

0 commit comments

Comments
 (0)