Skip to content

Commit

Permalink
Update event for btn update tables
Browse files Browse the repository at this point in the history
  • Loading branch information
TaQuangKhoi committed Aug 15, 2024
1 parent 6069b4e commit eb431de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mod database;
mod table;
mod core;
mod widgets;
mod queries;
13 changes: 12 additions & 1 deletion src/widgets/update_tables_button.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::env::var;
use std::thread;
use crate::TwoDBApp;
use crate::working_database::{update_all_tables};

impl TwoDBApp {
pub fn render_update_tables_button(&mut self, ui: &mut egui::Ui) {
Expand All @@ -10,6 +13,14 @@ impl TwoDBApp {
}

fn button_update_tables_event(&mut self) {
todo!()
thread::spawn(move || {
let database_name_source = var("POSTGRES_DB_SOURCE").unwrap_or(String::from(""));
update_all_tables(&database_name_source);

let database_name_target = var("POSTGRES_DB_TARGET").unwrap_or(String::from(""));
update_all_tables(&database_name_target);

let text = format!("Done Get All Tables for {} and {}", database_name_source, database_name_target);
});
}
}

0 comments on commit eb431de

Please sign in to comment.