mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
build(deps): use async-bb8-diesel from crates.io instead of git repository (#2619)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -487,7 +487,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "async-bb8-diesel"
|
name = "async-bb8-diesel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/oxidecomputer/async-bb8-diesel?rev=be3d9bce50051d8c0e0c06078e8066cc27db3001#be3d9bce50051d8c0e0c06078e8066cc27db3001"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "779f1fa3defe66bf147fe5c811b23a02cfcaa528a25293e0b20d1911eac1fb05"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"bb8",
|
"bb8",
|
||||||
|
|||||||
@ -15,7 +15,7 @@ kv_store = []
|
|||||||
s3 = ["dep:aws-sdk-s3", "dep:aws-config"]
|
s3 = ["dep:aws-sdk-s3", "dep:aws-config"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }
|
async-bb8-diesel = "0.1.0"
|
||||||
aws-config = { version = "0.55.3", optional = true }
|
aws-config = { version = "0.55.3", optional = true }
|
||||||
aws-sdk-s3 = { version = "0.28.0", optional = true }
|
aws-sdk-s3 = { version = "0.28.0", optional = true }
|
||||||
diesel = { version = "2.1.0", features = ["postgres", "serde_json", "time", "64-column-tables"] }
|
diesel = { version = "2.1.0", features = ["postgres", "serde_json", "time", "64-column-tables"] }
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use async_bb8_diesel::{AsyncRunQueryDsl, ConnectionError};
|
use async_bb8_diesel::AsyncRunQueryDsl;
|
||||||
use diesel::{
|
use diesel::{
|
||||||
associations::HasTable,
|
associations::HasTable,
|
||||||
debug_query,
|
debug_query,
|
||||||
@ -93,10 +93,9 @@ where
|
|||||||
{
|
{
|
||||||
Ok(value) => Ok(value),
|
Ok(value) => Ok(value),
|
||||||
Err(err) => match err.current_context() {
|
Err(err) => match err.current_context() {
|
||||||
ConnectionError::Query(DieselError::DatabaseError(
|
DieselError::DatabaseError(diesel::result::DatabaseErrorKind::UniqueViolation, _) => {
|
||||||
diesel::result::DatabaseErrorKind::UniqueViolation,
|
Err(err).change_context(errors::DatabaseError::UniqueViolation)
|
||||||
_,
|
}
|
||||||
)) => Err(err).change_context(errors::DatabaseError::UniqueViolation),
|
|
||||||
_ => Err(err).change_context(errors::DatabaseError::Others),
|
_ => Err(err).change_context(errors::DatabaseError::Others),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -168,14 +167,12 @@ where
|
|||||||
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
|
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
Err(ConnectionError::Query(DieselError::QueryBuilderError(_))) => {
|
Err(DieselError::QueryBuilderError(_)) => {
|
||||||
Err(report!(errors::DatabaseError::NoFieldsToUpdate))
|
Err(report!(errors::DatabaseError::NoFieldsToUpdate))
|
||||||
.attach_printable_lazy(|| format!("Error while updating {debug_values}"))
|
.attach_printable_lazy(|| format!("Error while updating {debug_values}"))
|
||||||
}
|
}
|
||||||
Err(ConnectionError::Query(DieselError::NotFound)) => {
|
Err(DieselError::NotFound) => Err(report!(errors::DatabaseError::NotFound))
|
||||||
Err(report!(errors::DatabaseError::NotFound))
|
.attach_printable_lazy(|| format!("Error while updating {debug_values}")),
|
||||||
.attach_printable_lazy(|| format!("Error while updating {debug_values}"))
|
|
||||||
}
|
|
||||||
_ => Err(report!(errors::DatabaseError::Others))
|
_ => Err(report!(errors::DatabaseError::Others))
|
||||||
.attach_printable_lazy(|| format!("Error while updating {debug_values}")),
|
.attach_printable_lazy(|| format!("Error while updating {debug_values}")),
|
||||||
}
|
}
|
||||||
@ -259,14 +256,12 @@ where
|
|||||||
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
|
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
Err(ConnectionError::Query(DieselError::QueryBuilderError(_))) => {
|
Err(DieselError::QueryBuilderError(_)) => {
|
||||||
Err(report!(errors::DatabaseError::NoFieldsToUpdate))
|
Err(report!(errors::DatabaseError::NoFieldsToUpdate))
|
||||||
.attach_printable_lazy(|| format!("Error while updating by ID {debug_values}"))
|
.attach_printable_lazy(|| format!("Error while updating by ID {debug_values}"))
|
||||||
}
|
}
|
||||||
Err(ConnectionError::Query(DieselError::NotFound)) => {
|
Err(DieselError::NotFound) => Err(report!(errors::DatabaseError::NotFound))
|
||||||
Err(report!(errors::DatabaseError::NotFound))
|
.attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")),
|
||||||
.attach_printable_lazy(|| format!("Error while updating by ID {debug_values}"))
|
|
||||||
}
|
|
||||||
_ => Err(report!(errors::DatabaseError::Others))
|
_ => Err(report!(errors::DatabaseError::Others))
|
||||||
.attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")),
|
.attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")),
|
||||||
}
|
}
|
||||||
@ -353,9 +348,7 @@ where
|
|||||||
{
|
{
|
||||||
Ok(value) => Ok(value),
|
Ok(value) => Ok(value),
|
||||||
Err(err) => match err.current_context() {
|
Err(err) => match err.current_context() {
|
||||||
ConnectionError::Query(DieselError::NotFound) => {
|
DieselError::NotFound => Err(err).change_context(errors::DatabaseError::NotFound),
|
||||||
Err(err).change_context(errors::DatabaseError::NotFound)
|
|
||||||
}
|
|
||||||
_ => Err(err).change_context(errors::DatabaseError::Others),
|
_ => Err(err).change_context(errors::DatabaseError::Others),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -404,9 +397,7 @@ where
|
|||||||
.await
|
.await
|
||||||
.into_report()
|
.into_report()
|
||||||
.map_err(|err| match err.current_context() {
|
.map_err(|err| match err.current_context() {
|
||||||
ConnectionError::Query(DieselError::NotFound) => {
|
DieselError::NotFound => err.change_context(errors::DatabaseError::NotFound),
|
||||||
err.change_context(errors::DatabaseError::NotFound)
|
|
||||||
}
|
|
||||||
_ => err.change_context(errors::DatabaseError::Others),
|
_ => err.change_context(errors::DatabaseError::Others),
|
||||||
})
|
})
|
||||||
.attach_printable_lazy(|| "Error finding record by predicate")
|
.attach_printable_lazy(|| "Error finding record by predicate")
|
||||||
|
|||||||
@ -13,7 +13,7 @@ kms = ["external_services/kms"]
|
|||||||
vergen = ["router_env/vergen"]
|
vergen = ["router_env/vergen"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }
|
async-bb8-diesel = "0.1.0"
|
||||||
bb8 = "0.8"
|
bb8 = "0.8"
|
||||||
clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] }
|
clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] }
|
||||||
config = { version = "0.13.3", features = ["toml"] }
|
config = { version = "0.13.3", features = ["toml"] }
|
||||||
|
|||||||
@ -35,7 +35,7 @@ actix-cors = "0.6.4"
|
|||||||
actix-multipart = "0.6.0"
|
actix-multipart = "0.6.0"
|
||||||
actix-rt = "2.8.0"
|
actix-rt = "2.8.0"
|
||||||
actix-web = "4.3.1"
|
actix-web = "4.3.1"
|
||||||
async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }
|
async-bb8-diesel = "0.1.0"
|
||||||
async-trait = "0.1.68"
|
async-trait = "0.1.68"
|
||||||
aws-config = { version = "0.55.3", optional = true }
|
aws-config = { version = "0.55.3", optional = true }
|
||||||
aws-sdk-s3 = { version = "0.28.0", optional = true }
|
aws-sdk-s3 = { version = "0.28.0", optional = true }
|
||||||
|
|||||||
@ -28,7 +28,7 @@ router_derive = { version = "0.1.0", path = "../router_derive" }
|
|||||||
|
|
||||||
# Third party crates
|
# Third party crates
|
||||||
actix-web = "4.3.1"
|
actix-web = "4.3.1"
|
||||||
async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "be3d9bce50051d8c0e0c06078e8066cc27db3001" }
|
async-bb8-diesel = "0.1.0"
|
||||||
async-trait = "0.1.72"
|
async-trait = "0.1.72"
|
||||||
bb8 = "0.8.1"
|
bb8 = "0.8.1"
|
||||||
bytes = "1.4.0"
|
bytes = "1.4.0"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#[cfg(feature = "olap")]
|
#[cfg(feature = "olap")]
|
||||||
use async_bb8_diesel::AsyncRunQueryDsl;
|
use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};
|
||||||
use common_utils::{date_time, ext_traits::Encode};
|
use common_utils::{date_time, ext_traits::Encode};
|
||||||
#[cfg(feature = "olap")]
|
#[cfg(feature = "olap")]
|
||||||
use data_models::payments::payment_intent::PaymentIntentFetchConstraints;
|
use data_models::payments::payment_intent::PaymentIntentFetchConstraints;
|
||||||
@ -34,6 +34,8 @@ use redis_interface::HsetnxReply;
|
|||||||
use router_env::logger;
|
use router_env::logger;
|
||||||
use router_env::{instrument, tracing};
|
use router_env::{instrument, tracing};
|
||||||
|
|
||||||
|
#[cfg(feature = "olap")]
|
||||||
|
use crate::connection;
|
||||||
use crate::{
|
use crate::{
|
||||||
diesel_error_to_data_error,
|
diesel_error_to_data_error,
|
||||||
redis::kv_store::{kv_wrapper, KvOperation},
|
redis::kv_store::{kv_wrapper, KvOperation},
|
||||||
@ -387,7 +389,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
|
|||||||
filters: &PaymentIntentFetchConstraints,
|
filters: &PaymentIntentFetchConstraints,
|
||||||
storage_scheme: MerchantStorageScheme,
|
storage_scheme: MerchantStorageScheme,
|
||||||
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
|
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
|
||||||
let conn = self.get_replica_pool();
|
use common_utils::errors::ReportSwitchExt;
|
||||||
|
|
||||||
|
let conn = connection::pg_connection_read(self).await.switch()?;
|
||||||
|
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
|
||||||
|
|
||||||
//[#350]: Replace this with Boxable Expression and pass it into generic filter
|
//[#350]: Replace this with Boxable Expression and pass it into generic filter
|
||||||
// when https://github.com/rust-lang/rust/issues/52662 becomes stable
|
// when https://github.com/rust-lang/rust/issues/52662 becomes stable
|
||||||
@ -509,8 +514,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
|
|||||||
constraints: &PaymentIntentFetchConstraints,
|
constraints: &PaymentIntentFetchConstraints,
|
||||||
storage_scheme: MerchantStorageScheme,
|
storage_scheme: MerchantStorageScheme,
|
||||||
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
|
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
|
||||||
let conn = self.get_replica_pool();
|
use common_utils::errors::ReportSwitchExt;
|
||||||
|
|
||||||
|
let conn = connection::pg_connection_read(self).await.switch()?;
|
||||||
|
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
|
||||||
let mut query = DieselPaymentIntent::table()
|
let mut query = DieselPaymentIntent::table()
|
||||||
.inner_join(
|
.inner_join(
|
||||||
diesel_models::schema::payment_attempt::table
|
diesel_models::schema::payment_attempt::table
|
||||||
@ -646,8 +653,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
|
|||||||
constraints: &PaymentIntentFetchConstraints,
|
constraints: &PaymentIntentFetchConstraints,
|
||||||
_storage_scheme: MerchantStorageScheme,
|
_storage_scheme: MerchantStorageScheme,
|
||||||
) -> error_stack::Result<Vec<String>, StorageError> {
|
) -> error_stack::Result<Vec<String>, StorageError> {
|
||||||
let conn = self.get_replica_pool();
|
use common_utils::errors::ReportSwitchExt;
|
||||||
|
|
||||||
|
let conn = connection::pg_connection_read(self).await.switch()?;
|
||||||
|
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
|
||||||
let mut query = DieselPaymentIntent::table()
|
let mut query = DieselPaymentIntent::table()
|
||||||
.select(pi_dsl::active_attempt_id)
|
.select(pi_dsl::active_attempt_id)
|
||||||
.filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
|
.filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
|
||||||
|
|||||||
Reference in New Issue
Block a user