chore: add rustfmt.toml and apply unified code formatting
This commit is contained in:
1 parent
edcdd652ae
commit
41445ff474
53 files changed
+1177
-2592
No files matched your search
@@ -16,20 +16,11 @@ pub async fn execute_query(
|
||||
sql: String,
|
||||
execution_id: Option<String>,
|
||||
) -> Result<db::QueryResult, String> {
|
||||
let registered_query = execution_id
|
||||
.as_ref()
|
||||
.filter(|id| !id.trim().is_empty())
|
||||
.map(|id| state.running_queries.register(id.clone()));
|
||||
let registered_query =
|
||||
execution_id.as_ref().filter(|id| !id.trim().is_empty()).map(|id| state.running_queries.register(id.clone()));
|
||||
let cancel_token = registered_query.as_ref().map(|query| query.token());
|
||||
|
||||
dbx_core::query::execute_sql_statement(
|
||||
&state,
|
||||
&connection_id,
|
||||
&database,
|
||||
&sql,
|
||||
cancel_token,
|
||||
)
|
||||
.await
|
||||
dbx_core::query::execute_sql_statement(&state, &connection_id, &database, &sql, cancel_token).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -40,27 +31,15 @@ pub async fn execute_multi(
|
||||
sql: String,
|
||||
execution_id: Option<String>,
|
||||
) -> Result<Vec<db::QueryResult>, String> {
|
||||
let registered_query = execution_id
|
||||
.as_ref()
|
||||
.filter(|id| !id.trim().is_empty())
|
||||
.map(|id| state.running_queries.register(id.clone()));
|
||||
let registered_query =
|
||||
execution_id.as_ref().filter(|id| !id.trim().is_empty()).map(|id| state.running_queries.register(id.clone()));
|
||||
let cancel_token = registered_query.as_ref().map(|query| query.token());
|
||||
|
||||
dbx_core::query::execute_multi_core(
|
||||
&state,
|
||||
&connection_id,
|
||||
&database,
|
||||
&sql,
|
||||
cancel_token,
|
||||
)
|
||||
.await
|
||||
dbx_core::query::execute_multi_core(&state, &connection_id, &database, &sql, cancel_token).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn cancel_query(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
execution_id: String,
|
||||
) -> Result<bool, String> {
|
||||
pub async fn cancel_query(state: State<'_, Arc<AppState>>, execution_id: String) -> Result<bool, String> {
|
||||
Ok(state.running_queries.cancel(&execution_id))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user