mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
refactor(storage_models): made generic queries public (#395)
This commit is contained in:
@ -24,7 +24,7 @@ use router_env::{instrument, logger, tracing};
|
|||||||
use crate::{errors, PgPooledConn, StorageResult};
|
use crate::{errors, PgPooledConn, StorageResult};
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_insert<T, V, R>(conn: &PgPooledConn, values: V) -> StorageResult<R>
|
pub async fn generic_insert<T, V, R>(conn: &PgPooledConn, values: V) -> StorageResult<R>
|
||||||
where
|
where
|
||||||
T: HasTable<Table = T> + Table + 'static,
|
T: HasTable<Table = T> + Table + 'static,
|
||||||
V: Debug + Insertable<T>,
|
V: Debug + Insertable<T>,
|
||||||
@ -53,7 +53,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_update<T, V, P>(
|
pub async fn generic_update<T, V, P>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
predicate: P,
|
predicate: P,
|
||||||
values: V,
|
values: V,
|
||||||
@ -82,7 +82,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_update_with_results<T, V, P, R>(
|
pub async fn generic_update_with_results<T, V, P, R>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
predicate: P,
|
predicate: P,
|
||||||
values: V,
|
values: V,
|
||||||
@ -112,7 +112,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_update_by_id<T, V, Pk, R>(
|
pub async fn generic_update_by_id<T, V, Pk, R>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
id: Pk,
|
id: Pk,
|
||||||
values: V,
|
values: V,
|
||||||
@ -160,7 +160,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_delete<T, P>(conn: &PgPooledConn, predicate: P) -> StorageResult<bool>
|
pub async fn generic_delete<T, P>(conn: &PgPooledConn, predicate: P) -> StorageResult<bool>
|
||||||
where
|
where
|
||||||
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
|
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
|
||||||
<T as FilterDsl<P>>::Output: IntoUpdateTarget,
|
<T as FilterDsl<P>>::Output: IntoUpdateTarget,
|
||||||
@ -191,7 +191,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_delete_one_with_result<T, P, R>(
|
pub async fn generic_delete_one_with_result<T, P, R>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
predicate: P,
|
predicate: P,
|
||||||
) -> StorageResult<R>
|
) -> StorageResult<R>
|
||||||
@ -247,7 +247,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_find_by_id<T, Pk, R>(conn: &PgPooledConn, id: Pk) -> StorageResult<R>
|
pub async fn generic_find_by_id<T, Pk, R>(conn: &PgPooledConn, id: Pk) -> StorageResult<R>
|
||||||
where
|
where
|
||||||
T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static,
|
T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static,
|
||||||
<T as FindDsl<Pk>>::Output: QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
|
<T as FindDsl<Pk>>::Output: QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static,
|
||||||
@ -260,7 +260,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_find_by_id_optional<T, Pk, R>(
|
pub async fn generic_find_by_id_optional<T, Pk, R>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
id: Pk,
|
id: Pk,
|
||||||
) -> StorageResult<Option<R>>
|
) -> StorageResult<Option<R>>
|
||||||
@ -302,7 +302,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_find_one<T, P, R>(conn: &PgPooledConn, predicate: P) -> StorageResult<R>
|
pub async fn generic_find_one<T, P, R>(conn: &PgPooledConn, predicate: P) -> StorageResult<R>
|
||||||
where
|
where
|
||||||
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
|
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
|
||||||
<T as FilterDsl<P>>::Output:
|
<T as FilterDsl<P>>::Output:
|
||||||
@ -313,7 +313,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_find_one_optional<T, P, R>(
|
pub async fn generic_find_one_optional<T, P, R>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
predicate: P,
|
predicate: P,
|
||||||
) -> StorageResult<Option<R>>
|
) -> StorageResult<Option<R>>
|
||||||
@ -327,7 +327,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "DEBUG", skip_all)]
|
#[instrument(level = "DEBUG", skip_all)]
|
||||||
pub(super) async fn generic_filter<T, P, R>(
|
pub async fn generic_filter<T, P, R>(
|
||||||
conn: &PgPooledConn,
|
conn: &PgPooledConn,
|
||||||
predicate: P,
|
predicate: P,
|
||||||
limit: Option<i64>,
|
limit: Option<i64>,
|
||||||
|
|||||||
Reference in New Issue
Block a user