2023-11-19 19:10:13 -08:00
|
|
|
use redis::Cmd;
|
|
|
|
|
|
|
|
|
|
pub fn redis_args(cmd: &mut Cmd, args: &[String]) {
|
|
|
|
|
for arg in args {
|
|
|
|
|
cmd.arg(arg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn redis_execute<T>(
|
|
|
|
|
cmd: &mut Cmd,
|
|
|
|
|
redis: &mut deadpool_redis::Connection,
|
|
|
|
|
) -> Result<T, deadpool_redis::PoolError>
|
|
|
|
|
where
|
|
|
|
|
T: redis::FromRedisValue,
|
|
|
|
|
{
|
2024-10-18 16:07:35 -07:00
|
|
|
let res = cmd.query_async::<T>(redis).await?;
|
2023-11-19 19:10:13 -08:00
|
|
|
Ok(res)
|
|
|
|
|
}
|