feat(connection): add visible schema filtering
This commit is contained in:
29 files changed
+602
-22
No files matched your search
@@ -583,6 +583,7 @@ mod tests {
|
||||
password: "secret".to_string(),
|
||||
database: database.map(str::to_string),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -602,6 +602,7 @@ mod tests {
|
||||
password: "secret".to_string(),
|
||||
database: None,
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: vec![TransportLayerConfig::Ssh(crate::models::connection::SshTunnelConfig {
|
||||
|
||||
@@ -2388,6 +2388,7 @@ mod tests {
|
||||
password: "secret".to_string(),
|
||||
database: database.map(str::to_string),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -705,6 +705,7 @@ mod tests {
|
||||
password: password.to_string(),
|
||||
database: Some("postgres".to_string()),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -2592,6 +2592,7 @@ mod tests {
|
||||
password: String::new(),
|
||||
database: Some("4".to_string()),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use percent_encoding::{percent_decode_str, utf8_percent_encode, NON_ALPHANUMERIC};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, PartialEq)]
|
||||
pub struct ConnectionConfig {
|
||||
@@ -20,6 +21,8 @@ pub struct ConnectionConfig {
|
||||
pub database: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub visible_databases: Option<Vec<String>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub visible_schemas: Option<HashMap<String, Vec<String>>>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub attached_databases: Vec<AttachedDatabaseConfig>,
|
||||
#[serde(default)]
|
||||
@@ -346,6 +349,8 @@ struct ConnectionConfigData {
|
||||
#[serde(default)]
|
||||
pub visible_databases: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub visible_schemas: Option<HashMap<String, Vec<String>>>,
|
||||
#[serde(default)]
|
||||
pub attached_databases: Vec<AttachedDatabaseConfig>,
|
||||
#[serde(default)]
|
||||
pub color: Option<String>,
|
||||
@@ -422,6 +427,7 @@ impl From<ConnectionConfigData> for ConnectionConfig {
|
||||
password: data.password,
|
||||
database: data.database,
|
||||
visible_databases: data.visible_databases,
|
||||
visible_schemas: data.visible_schemas,
|
||||
attached_databases: data.attached_databases,
|
||||
color: data.color,
|
||||
transport_layers: data.transport_layers,
|
||||
@@ -1543,6 +1549,7 @@ mod tests {
|
||||
password: password.to_string(),
|
||||
database: database.map(str::to_string),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -109,6 +109,7 @@ mod tests {
|
||||
password: String::new(),
|
||||
database: None,
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -503,6 +503,7 @@ mod tests {
|
||||
password: String::new(),
|
||||
database: None,
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -2444,6 +2444,7 @@ mod tests {
|
||||
password: String::new(),
|
||||
database: None,
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -1209,6 +1209,7 @@ mod tests {
|
||||
password: "secret".to_string(),
|
||||
database: Some("demo".to_string()),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -157,6 +157,7 @@ mod tests {
|
||||
password: "secret".to_string(),
|
||||
database: Some("demo".to_string()),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -1887,6 +1887,7 @@ mod tests {
|
||||
password: String::new(),
|
||||
database: None,
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -3551,6 +3551,7 @@ mod tests {
|
||||
password: String::new(),
|
||||
database: None,
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
@@ -22,6 +22,7 @@ fn postgres_test_config(id: &str, database: &str) -> ConnectionConfig {
|
||||
password: String::new(),
|
||||
database: Some(database.to_string()),
|
||||
visible_databases: None,
|
||||
visible_schemas: None,
|
||||
attached_databases: Vec::new(),
|
||||
color: None,
|
||||
transport_layers: Vec::new(),
|
||||
|
||||
Reference in new issue
Block a user