feat(xugu): expose object type members in schema tree
This commit is contained in:
1 parent
d7e93453c7
commit
1b37e97486
30 files changed
+1364
-63
No files matched your search
@@ -2537,6 +2537,7 @@ mod tests {
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ pub async fn list_objects(pool: &MySqlPool, database: &str) -> Result<Vec<Object
|
||||
updated_at: None,
|
||||
parent_schema: table.parent_schema,
|
||||
parent_name: table.parent_name,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -108,6 +109,7 @@ fn plugin_object(
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2959,6 +2959,7 @@ fn row_to_object(row: &mysql_async::Row, database: &str) -> ObjectInfo {
|
||||
updated_at: get_opt_str(row, "updated_at"),
|
||||
parent_schema: get_opt_str(row, "parent_schema"),
|
||||
parent_name: get_opt_str(row, "parent_name"),
|
||||
xugu_type_members_expandable: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3229,6 +3230,7 @@ fn table_infos_to_objects(
|
||||
updated_at: meta.and_then(|meta| meta.updated_at.clone()),
|
||||
parent_schema: table.parent_schema,
|
||||
parent_name: table.parent_name,
|
||||
xugu_type_members_expandable: None,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
@@ -5375,6 +5377,7 @@ mod tests {
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ pub async fn list_objects(pool: &mysql_async::Pool, schema: &str) -> Result<Vec<
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
@@ -3122,6 +3122,7 @@ pub async fn list_objects(pool: &Pool, schema: &str) -> Result<Vec<ObjectInfo>,
|
||||
parent_schema: row.try_get::<_, Option<String>>(5).ok().flatten().filter(|s| !s.is_empty()),
|
||||
parent_name: row.try_get::<_, Option<String>>(6).ok().flatten().filter(|s| !s.is_empty()),
|
||||
signature: row.try_get::<_, Option<String>>(7).ok().flatten(),
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ pub async fn list_objects(pool: &Pool, schema: &str) -> Result<Vec<ObjectInfo>,
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
@@ -2324,6 +2324,7 @@ pub async fn list_objects(client: &mut SqlServerClient, schema: &str) -> Result<
|
||||
updated_at: row.get::<chrono::NaiveDateTime, _>(3).map(|value| value.to_string()),
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
@@ -2388,6 +2388,7 @@ async fn external_driver_presto_like_objects(
|
||||
updated_at: None,
|
||||
parent_schema: table.parent_schema,
|
||||
parent_name: table.parent_name,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
@@ -3241,6 +3242,7 @@ for line in sys.stdin:
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4139,6 +4141,7 @@ for line in sys.stdin:
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
},
|
||||
super::db::ObjectInfo {
|
||||
name: "ORDERS_VIEW".to_string(),
|
||||
@@ -4151,6 +4154,7 @@ for line in sys.stdin:
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
},
|
||||
super::db::ObjectInfo {
|
||||
name: "REFRESH_ORDERS".to_string(),
|
||||
@@ -4163,6 +4167,7 @@ for line in sys.stdin:
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -4844,6 +4849,7 @@ async fn list_objects_once(
|
||||
updated_at: None,
|
||||
parent_schema: table.parent_schema,
|
||||
parent_name: table.parent_name,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect(),
|
||||
))
|
||||
@@ -7102,6 +7108,7 @@ async fn oracle_agent_list_objects(
|
||||
updated_at: None,
|
||||
parent_schema: None,
|
||||
parent_name: None,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -76,6 +76,8 @@ pub struct ObjectInfo {
|
||||
pub updated_at: Option<String>,
|
||||
pub parent_schema: Option<String>,
|
||||
pub parent_name: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub xugu_type_members_expandable: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -579,11 +581,14 @@ mod tests {
|
||||
#[test]
|
||||
fn list_objects_payload_preserves_optional_validity() {
|
||||
let objects: Vec<ObjectInfo> =
|
||||
serde_json::from_str(r#"[{"name":"TRG_AUDIT","object_type":"TRIGGER","schema":"APP","valid":false}]"#)
|
||||
serde_json::from_str(
|
||||
r#"[{"name":"TRG_AUDIT","object_type":"TRIGGER","schema":"APP","valid":false},{"name":"ORDER_TYPE","object_type":"TYPE","schema":"APP","xugu_type_members_expandable":true}]"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(objects[0].valid, Some(false));
|
||||
assert_eq!(objects[0].object_type, "TRIGGER");
|
||||
assert_eq!(objects[1].xugu_type_members_expandable, Some(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -255,6 +255,7 @@ pub async fn list_objects(
|
||||
updated_at: None,
|
||||
parent_schema: table.parent_schema,
|
||||
parent_name: table.parent_name,
|
||||
xugu_type_members_expandable: None,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user