feat(salesforce): add Salesforce SOQL data source

This commit is contained in:
邹超 authored and GitHub committed 2026-09-24 18:25:23 +08:00
1 parent bf3e356540
commit f87b5d1568
125 files changed
+9999 -117

No files matched your search

+15
View File
@@ -1125,6 +1125,7 @@ impl ConnectionConfig {
let scheme = if self.ssl { "https" } else { "http" };
format!("{scheme}://{host}:{port}")
}
DatabaseType::Salesforce => salesforce_instance_url(raw_host, self.ssl, port),
DatabaseType::Dameng => format!("dm://{host}:{port}{db_part}"),
DatabaseType::Kingbase => format!("kingbase://{host}:{port}{db_part}"),
DatabaseType::Highgo => format!("highgo://{host}:{port}{db_part}"),
@@ -1310,6 +1311,7 @@ impl ConnectionConfig {
let scheme = if self.ssl { "https" } else { "http" };
format!("{scheme}://{host}:{port}")
}
DatabaseType::Salesforce => salesforce_instance_url(raw_host, self.ssl, port),
DatabaseType::Dameng => {
format!("dm://{}:{}@{host}:{port}{db_part}", username, password)
}
@@ -2604,6 +2606,19 @@ fn bracket_ipv6(host: &str) -> String {
}
}
/// Salesforce connections store the org instance in `host`: either a full URL
/// (`https://acme.my.salesforce.com`) or a bare hostname. The access token
/// lives in the password field and never appears in the URL, so the redacted
/// and full forms are identical.
fn salesforce_instance_url(raw_host: &str, ssl: bool, port: u16) -> String {
let trimmed = raw_host.trim().trim_end_matches('/');
if trimmed.starts_with("http://") || trimmed.starts_with("https://") {
return trimmed.to_string();
}
let scheme = if ssl { "https" } else { "http" };
format!("{scheme}://{}:{port}", bracket_ipv6(trimmed))
}
/// Returns `true` when `host` contains two or more comma-separated entries
/// where each entry already embeds its own `:port` suffix.
///