Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

style(redis): 修正 Rust 格式检查

Bacon2994b669efb5ff37
diff --git a/crates/dbx-core/src/db/redis_driver.rs b/crates/dbx-core/src/db/redis_driver.rs
index aad94e96e5..d2b30912c5 100644
--- a/crates/dbx-core/src/db/redis_driver.rs
+++ b/crates/dbx-core/src/db/redis_driver.rs
@@ -139,7 +139,8 @@ pub async fn get_value(con: &mut redis::aio::MultiplexedConnection, key: &[u8])
(redis_raw_to_json(v), value_is_binary)
}
"list" => {
- let v: RedisRawValue = redis::cmd("LRANGE").arg(key).arg(0).arg(-1).query_async(con).await.map_err(|e| e.to_string())?;
+ let v: RedisRawValue =
+ redis::cmd("LRANGE").arg(key).arg(0).arg(-1).query_async(con).await.map_err(|e| e.to_string())?;
(redis_array_to_json(v), false)
}
"set" => {
@@ -368,9 +369,7 @@ pub fn redis_key_bytes_to_raw(bytes: &[u8]) -> String {
}
pub fn redis_key_raw_to_bytes(value: &str) -> Result<Vec<u8>, String> {
- base64::engine::general_purpose::STANDARD
- .decode(value)
- .map_err(|e| format!("Invalid Redis key encoding: {e}"))
+ base64::engine::general_purpose::STANDARD.decode(value).map_err(|e| format!("Invalid Redis key encoding: {e}"))
}
pub async fn set_string(
@@ -426,8 +425,8 @@ pub async fn set_remove(con: &mut redis::aio::MultiplexedConnection, key: &[u8],
#[cfg(test)]
mod tests {
use super::{
- parse_database_count, parse_scan_keys, parse_stream_entries, redis_key_bytes_to_display, redis_key_bytes_to_raw,
- redis_key_raw_to_bytes, redis_raw_to_json, RedisRawValue,
+ parse_database_count, parse_scan_keys, parse_stream_entries, redis_key_bytes_to_display,
+ redis_key_bytes_to_raw, redis_key_raw_to_bytes, redis_raw_to_json, RedisRawValue,
};
fn bulk(value: &str) -> RedisRawValue {
diff --git a/src-web/src/routes/redis.rs b/src-web/src/routes/redis.rs
index d731b01817..42d520a2cb 100644
--- a/src-web/src/routes/redis.rs
+++ b/src-web/src/routes/redis.rs
@@ -146,8 +146,8 @@ pub async fn hash_set(
&req.field,
value,
)
- .await
- .map_err(AppError)?;
+ .await
+ .map_err(AppError)?;
Ok(Json(()))
}
@@ -197,13 +197,7 @@ pub async fn set_remove(
State(state): State<Arc<WebState>>,
Json(req): Json<RedisSetRequest>,
) -> Result<Json<()>, AppError> {
- dbx_core::redis_ops::redis_set_remove_in_db_core(
- &state.app,
- &req.connection_id,
- req.db,
- &req.key_raw,
- &req.member,
- )
+ dbx_core::redis_ops::redis_set_remove_in_db_core(&state.app, &req.connection_id, req.db, &req.key_raw, &req.member)
.await
.map_err(AppError)?;
Ok(Json(()))