Merge branch 'main' of https://github.com/Abeautifulsnow/dbx into feat/ai-agent-loop-phase1

This commit is contained in:
runstone committed 2026-06-12 18:52:05 +08:00
commit 40f0f98540
71 files changed
+6708 -1390

No files matched your search

+4
View File
@@ -46,6 +46,10 @@ use dbx_core::agent_events::AgentEvent;
use dbx_core::agent_loop::{run_agent_loop, AgentLoopContext};
use dbx_core::models::connection::DatabaseType;
use dbx_core::agent_events::AgentEvent;
use dbx_core::agent_loop::{run_agent_loop, AgentLoopContext};
use dbx_core::models::connection::DatabaseType;
#[tauri::command]
pub async fn ai_cancel_stream(session_id: String) -> Result<bool, String> {
Ok(dbx_core::ai::cancel_stream(&session_id).await)
+42 -2
View File
@@ -39,9 +39,8 @@ pub async fn list_objects(
connection_id: String,
database: String,
schema: String,
object_types: Option<Vec<String>>,
) -> Result<Vec<db::ObjectInfo>, String> {
dbx_core::schema::list_objects_core(&state, &connection_id, &database, &schema, object_types).await
dbx_core::schema::list_objects_core(&state, &connection_id, &database, &schema).await
}
#[tauri::command]
@@ -120,3 +119,44 @@ pub async fn get_table_ddl(
) -> Result<String, String> {
dbx_core::schema::get_table_ddl_core(&state, &connection_id, &database, &schema, &table).await
}
#[tauri::command]
pub async fn list_functions(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
schema: String,
) -> Result<Vec<db::FunctionInfo>, String> {
dbx_core::schema::list_functions_core(&state, &connection_id, &database, &schema).await
}
#[tauri::command]
pub async fn list_sequences(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
schema: String,
with_last_values: bool,
) -> Result<Vec<db::SequenceInfo>, String> {
dbx_core::schema::list_sequences_core(&state, &connection_id, &database, &schema, with_last_values).await
}
#[tauri::command]
pub async fn list_rules(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
schema: String,
) -> Result<Vec<db::RuleInfo>, String> {
dbx_core::schema::list_rules_core(&state, &connection_id, &database, &schema).await
}
#[tauri::command]
pub async fn list_owners(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
schema: String,
) -> Result<Vec<db::OwnerInfo>, String> {
dbx_core::schema::list_owners_core(&state, &connection_id, &database, &schema).await
}
+15 -1
View File
@@ -8,8 +8,22 @@ pub fn prepare_schema_diff(
#[tauri::command]
pub fn generate_schema_sync_sql(
diffs: Vec<dbx_core::schema_diff::TableDiff>,
function_diffs: Option<Vec<dbx_core::schema_diff::FunctionDiff>>,
sequence_diffs: Option<Vec<dbx_core::schema_diff::SequenceDiff>>,
rule_diffs: Option<Vec<dbx_core::schema_diff::RuleDiff>>,
owner_diffs: Option<Vec<dbx_core::schema_diff::OwnerDiff>>,
database_type: dbx_core::models::connection::DatabaseType,
target_schema: Option<String>,
cascade_delete: Option<bool>,
) -> Result<String, String> {
Ok(dbx_core::schema_diff::generate_schema_sync_sql(&diffs, database_type, target_schema.as_deref()))
Ok(dbx_core::schema_diff::generate_schema_sync_sql(
&diffs,
function_diffs.as_deref().unwrap_or_default(),
sequence_diffs.as_deref().unwrap_or_default(),
rule_diffs.as_deref().unwrap_or_default(),
owner_diffs.as_deref().unwrap_or_default(),
database_type,
target_schema.as_deref(),
cascade_delete.unwrap_or(false),
))
}