mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
fix(redis_interface): fix derps in HSET and HSETNX command wrappers (#129)
This commit is contained in:
@ -20,7 +20,7 @@ use router_env::{tracing, tracing::instrument};
|
||||
|
||||
use crate::{
|
||||
errors,
|
||||
types::{RedisEntryId, SetNXReply},
|
||||
types::{HsetnxReply, RedisEntryId, SetnxReply},
|
||||
};
|
||||
|
||||
impl super::RedisConnectionPool {
|
||||
@ -142,7 +142,7 @@ impl super::RedisConnectionPool {
|
||||
&self,
|
||||
key: &str,
|
||||
value: V,
|
||||
) -> CustomResult<SetNXReply, errors::RedisError>
|
||||
) -> CustomResult<SetnxReply, errors::RedisError>
|
||||
where
|
||||
V: TryInto<RedisValue> + Debug,
|
||||
V::Error: Into<fred::error::RedisError>,
|
||||
@ -203,28 +203,13 @@ impl super::RedisConnectionPool {
|
||||
.change_context(errors::RedisError::SetHashFailed)
|
||||
}
|
||||
|
||||
#[instrument(level = "DEBUG", skip(self))]
|
||||
pub async fn serialize_and_set_hash_fields<V>(
|
||||
&self,
|
||||
key: &str,
|
||||
values: V,
|
||||
) -> CustomResult<(), errors::RedisError>
|
||||
where
|
||||
V: serde::Serialize + Debug,
|
||||
{
|
||||
let serialized = Encode::<V>::encode_to_value(&values)
|
||||
.change_context(errors::RedisError::JsonSerializationFailed)?;
|
||||
|
||||
self.set_hash_fields(key, serialized).await
|
||||
}
|
||||
|
||||
#[instrument(level = "DEBUG", skip(self))]
|
||||
pub async fn set_hash_field_if_not_exist<V>(
|
||||
&self,
|
||||
key: &str,
|
||||
field: &str,
|
||||
value: V,
|
||||
) -> CustomResult<SetNXReply, errors::RedisError>
|
||||
) -> CustomResult<HsetnxReply, errors::RedisError>
|
||||
where
|
||||
V: TryInto<RedisValue> + Debug,
|
||||
V::Error: Into<fred::error::RedisError>,
|
||||
@ -242,7 +227,7 @@ impl super::RedisConnectionPool {
|
||||
key: &str,
|
||||
field: &str,
|
||||
value: V,
|
||||
) -> CustomResult<SetNXReply, errors::RedisError>
|
||||
) -> CustomResult<HsetnxReply, errors::RedisError>
|
||||
where
|
||||
V: serde::Serialize + Debug,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user