Skip to content

Commit

Permalink
Different proposal for how to express DQuantum hierarchy.
Browse files Browse the repository at this point in the history
  • Loading branch information
soenkeliebau committed Nov 26, 2024
1 parent 5cb05e8 commit 2f9eb08
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions rust/crd/src/resource_info_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ pub struct DQuantumBackend {
/// Must contain the fields `clientId` and `clientSecret`.
pub client_credentials_secret: String,

pub table_id: u8,
pub hierarchy: Entity,
pub hierarchy: TableEntity,
}

#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand All @@ -58,8 +57,8 @@ pub enum Relation {
pub struct TableEntity {
entity_name: String,
entity_id: u8,
parents: Entity,
children: Entity,
parents: Option<Box<Relation>>,
children: Option<Box<Relation>>,
}

#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand All @@ -79,7 +78,26 @@ mod tests {

#[test]
fn it_works() {
let entity = Entity {
let parents = Some(Box::new(Backward { entity: Entity {
entity_name: "data_collection".to_string(),
entity_id: 150,
relation: None,
}, relation_name: "data_assets".to_string() }));

let children = Some(Box::new(Backward { entity: Entity {
entity_name: "data_element".to_string(),
entity_id: 168,
relation: None,
}, relation_name: "data_asset".to_string() }));

let table_node = TableEntity{
entity_name: "data_asset".to_string(),
entity_id: 151,
parents,
children,
};

/*let entity = Entity {
entity_name: "data_collection".to_string(),
entity_id: 150,
relation: Some(Box::new(Forward {
Expand All @@ -99,8 +117,9 @@ mod tests {
})),
};
*/

let test = serde_yaml::to_string(&entity).unwrap();
let test = serde_yaml::to_string(&table_node).unwrap();
println!("{}", test);
}
}

0 comments on commit 2f9eb08

Please sign in to comment.