pub fn mod_gen(path: &PathBuf, tables_metadata: &TablesMetadata) -> Result<()> {
    let template = mustache::compile_str(MOD_RS)?;
    let mut table_mods = Vec::new();

    for table_name in tables_metadata.keys() {
        let lc_table_name: String = table_name.chars().map(|c| c.to_lowercase().to_string()).collect();
        table_mods.push(TableModBuilder::default().name(lc_table_name).build()?);
    }

    let dam_mod = ModBuilder::default().name("dam".to_string()).tables(table_mods).build()?;
    let mut module_path = PathBuf::from(path);
    module_path.push("mod.rs");

    let mod_file = File::create(module_path)?;
    let mut writer = BufWriter::new(mod_file);
    template.render(&mut writer, &dam_mod)?;

    Ok(())
}
/// Generate Rust code for main level module.
Generate Rust code for main level module.
Generate Rust code for main level module .
pub fn mod_gen(path: &PathBuf, tables_metadata: &TablesMetadata) -> Result<()> {
    let template = mustache::compile_str(MOD_RS)?;
    let mut table_mods = Vec::new();
    for table_name in tables_metadata.keys() {
        let lc_table_name: String = table_name.chars().map(|c| c.to_lowercase().to_string()).collect();
        table_mods.push(TableModBuilder::default().name(lc_table_name).build()?);
    }
    let dam_mod = ModBuilder::default().name("dam".to_string()).tables(table_mods).build()?;
    let mut module_path = PathBuf::from(path);
    module_path.push("mod.rs");
    let mod_file = File::create(module_path)?;
    let mut writer = BufWriter::new(mod_file);
    template.render(&mut writer, &dam_mod)?;
    Ok(())
}
pub fn mod_gen ( path : & PathBuf , tables_metadata : & TablesMetadata ) -> Result < ( ) > { let template = mustache :: compile_str ( MOD_RS ) ? ; let mut table_mods = Vec :: new ( ) ; for table_name in tables_metadata . keys ( ) { let lc_table_name : String = table_name . chars ( ) . map ( | c | c . to_lowercase ( ) . to_string ( ) ) . collect ( ) ; table_mods . push ( TableModBuilder :: default ( ) . name ( lc_table_name ) . build ( ) ? ) ; } let dam_mod = ModBuilder :: default ( ) . name ( " " . to_string ( ) ) . tables ( table_mods ) . build ( ) ? ; let mut module_path = PathBuf :: from ( path ) ; module_path . push ( " " ) ; let mod_file = File :: create ( module_path ) ? ; let mut writer = BufWriter :: new ( mod_file ) ; template . render ( & mut writer , & dam_mod ) ? ; Ok ( ( ) ) }
Generate Rust code for main level module.
Generate Rust code for main level module .
path
&PathBuf
tables_metadata
&TablesMetadata