use serde::{Deserialize, Serialize}; use std::path::Path; use std::error::Error; use dml_tools::sql::*; use dml_tools::util::*; #[derive(Serialize, Deserialize, Debug)] pub struct TestTables { pub basic: DynFields, pub sensitization: Option, pub foreign_keys: Option, } #[allow(dead_code)] pub fn read_test_tables>(path: P) -> Result< TestTables, Box> { Ok(read_yaml_from_file(path)?) } #[allow(dead_code)] pub fn test_table_with_writer_to_string(writer:&dyn TypeWriter) -> String { let fields = vec![ Field::new("id", &FieldAttributes::new_nn(FieldType::AutoInc)), Field::new("age", &FieldAttributes::new(FieldType::Int)), Field::new("year_of_birth", &FieldAttributes::new(FieldType::BigInt)), Field::new("name", &FieldAttributes::new(FieldType::Txt)), Field::new("weight", &FieldAttributes::new(FieldType::Dbl)), Field::new("is_married", &FieldAttributes::new(FieldType::Bool)), ]; let table = Table::new(&ObjectPath::new_table("myschema", "mytable"), fields, None); table.to_sql(writer) } #[allow(dead_code)] pub fn print_if_different(left:&str, right:&str) { if left != right { println!("\n Left:\n{left}\n---------\nRight:\n{right}\n") } }