style(rust): format core modules

This commit is contained in:
t8y2 committed 2026-05-28 19:23:49 +08:00
1 parent c124ce3b69
commit 2fbdffebf5
4 files changed
+9 -9

No files matched your search

+2 -1
View File
@@ -176,7 +176,8 @@ impl AppState {
PoolKind::Mysql(db::mysql::connect_bare(&url, connect_timeout).await?, MysqlMode::Bare) PoolKind::Mysql(db::mysql::connect_bare(&url, connect_timeout).await?, MysqlMode::Bare)
} }
DatabaseType::Mysql => { DatabaseType::Mysql => {
let pool = db::mysql::connect_with_ca_cert(&url, Some(&db_config.ca_cert_path), connect_timeout).await?; let pool =
db::mysql::connect_with_ca_cert(&url, Some(&db_config.ca_cert_path), connect_timeout).await?;
let mode = detect_ob_oracle_mode(&db_config, &pool).await; let mode = detect_ob_oracle_mode(&db_config, &pool).await;
PoolKind::Mysql(pool, mode) PoolKind::Mysql(pool, mode)
} }
+1 -4
View File
@@ -928,10 +928,7 @@ pub async fn execute_query_with_schema_and_max_rows(
max_rows: Option<usize>, max_rows: Option<usize>,
) -> Result<QueryResult, String> { ) -> Result<QueryResult, String> {
let client = pool.get().await.map_err(|e| e.to_string())?; let client = pool.get().await.map_err(|e| e.to_string())?;
client client.execute(&format!("SET search_path TO {}", pg_quote_ident(schema)), &[]).await.map_err(pg_error_to_string)?;
.execute(&format!("SET search_path TO {}", pg_quote_ident(schema)), &[])
.await
.map_err(pg_error_to_string)?;
let result = execute_query_with_max_rows_inner(&client, sql, max_rows).await; let result = execute_query_with_max_rows_inner(&client, sql, max_rows).await;
+3 -3
View File
@@ -1,12 +1,12 @@
use crate::query::MAX_ROWS;
use crate::sql::starts_with_executable_sql_keyword;
use crate::types::{ColumnInfo, DatabaseInfo, ForeignKeyInfo, IndexInfo, QueryResult, TableInfo, TriggerInfo};
use futures::TryStreamExt; use futures::TryStreamExt;
use rust_decimal::Decimal; use rust_decimal::Decimal;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use tiberius::{AuthMethod, Client, ColumnData, Config, FromSql, QueryItem, QueryStream, SqlBrowser}; use tiberius::{AuthMethod, Client, ColumnData, Config, FromSql, QueryItem, QueryStream, SqlBrowser};
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tokio_util::compat::{Compat, TokioAsyncWriteCompatExt}; use tokio_util::compat::{Compat, TokioAsyncWriteCompatExt};
use crate::query::MAX_ROWS;
use crate::sql::starts_with_executable_sql_keyword;
use crate::types::{ColumnInfo, DatabaseInfo, ForeignKeyInfo, IndexInfo, QueryResult, TableInfo, TriggerInfo};
pub type SqlServerClient = Client<Compat<TcpStream>>; pub type SqlServerClient = Client<Compat<TcpStream>>;
const SIMPLE_QUERY_MODULE_KEYWORDS: &[&str] = &["FUNCTION", "PROC", "PROCEDURE", "TRIGGER", "VIEW"]; const SIMPLE_QUERY_MODULE_KEYWORDS: &[&str] = &["FUNCTION", "PROC", "PROCEDURE", "TRIGGER", "VIEW"];
+3 -1
View File
@@ -827,7 +827,9 @@ fn bracket_ipv6(host: &str) -> String {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{default_query_timeout_secs, default_ssh_connect_timeout_secs, ConnectionConfig, DatabaseType, ProxyType}; use super::{
default_query_timeout_secs, default_ssh_connect_timeout_secs, ConnectionConfig, DatabaseType, ProxyType,
};
use std::str::FromStr; use std::str::FromStr;
fn mysql_config(username: &str, password: &str, database: Option<&str>) -> ConnectionConfig { fn mysql_config(username: &str, password: &str, database: Option<&str>) -> ConnectionConfig {