File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 44//! If you wan't to use axum the best way is to make a small wrapper around
55//! ConnOwned.
66//!
7- //! ```rust
7+ //! ```ignore
8+ //! use chuchi_postgres as pg;
9+ //! use pg::db::{Conn, Trans, Db};
10+ //! use axum::extract::{FromRequestParts, FromRef};
11+ //! use axum::http::request::Parts;
12+ //!
813//! pub struct ConnOwned(pub pg::db::ConnOwned);
914//!
1015//! impl ConnOwned {
2227//! S: Send + Sync,
2328//! Db: FromRef<S>,
2429//! {
25- //! type Rejection = Error ;
30+ //! type Rejection = MyError ;
2631//!
2732//! async fn from_request_parts(
2833//! _parts: &mut Parts,
3237//! db.get()
3338//! .await
3439//! .map(Self)
35- //! .map_err(|e| Error ::Internal(e.to_string()))
40+ //! .map_err(|e| MyError ::Internal(e.to_string()))
3641//! }
3742//! }
3843//! ```
You can’t perform that action at this time.
0 commit comments