Crates.io | aide-axum-sqlx-tx |
lib.rs | aide-axum-sqlx-tx |
version | 0.13.1 |
source | src |
created_at | 2023-09-23 22:17:51.059481 |
updated_at | 2024-04-14 00:47:42.677442 |
description | axum-sqlx-tx for aide |
homepage | |
repository | https://github.com/tamasfe/aide |
max_upload_size | |
id | 981577 |
size | 8,392 |
A drop-in replacement for axum-sqlx-tx
that provides an aide compatible re-export.
It is not the original type, but it implements deref and deref-mut, so if you have issues and need the real axum-sqlx-tx::Tx
type try using the deref operator:
*tx
or &*tx
or &mut *tx
default
or sqlx-07
: uses axum-sqlx-tx:0.6.0
and is compatible with sqlx:0.7
sqlx-06
: overrides default sqlx-07 and uses axum-sqlx-tx:0.5.0
and is compatible with sqlx:0.6
axum-sqlx-tx
features except sqlite
due to build issues.use aide_axum_sqlx_tx::Tx;
use sqlx::{Postgres, query};
async fn get_hello_world(
mut tx: Tx<Postgres>,
) -> Result<String, String> {
let (res,): (String,) = sqlx::query_as("select 'hello world'")
.fetch_one(&mut *tx) // deref mut
.await.map_err(|err|err.to_string())?;
Ok(res)
}