First try of implementing database
This commit is contained in:
18
src/main.rs
18
src/main.rs
@@ -1,12 +1,17 @@
|
||||
mod database;
|
||||
mod mcdu;
|
||||
mod sheet_listing;
|
||||
|
||||
use std::{env, path::PathBuf, process};
|
||||
|
||||
use database::Database;
|
||||
use gtk::prelude::*;
|
||||
use mcdu::McduModel;
|
||||
use relm4::prelude::*;
|
||||
use sheet_listing::{SheetListingInput, SheetListingModel};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
||||
use crate::database::Sheet;
|
||||
|
||||
struct AppModel {
|
||||
mcdu: Controller<McduModel>,
|
||||
@@ -89,7 +94,18 @@ impl SimpleComponent for AppModel {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenvy::dotenv().unwrap();
|
||||
|
||||
let mut database = Database::new();
|
||||
database.init_connection("./testdb.db").await.unwrap();
|
||||
database.setup_db().await.unwrap();
|
||||
|
||||
database.insert_sheet(Sheet::new_debug()).await.unwrap();
|
||||
let sheets = database.fetch_all_sheets().await.unwrap();
|
||||
println!("Sheets: {:?}", sheets);
|
||||
|
||||
let app = RelmApp::new("de.frajul.sheet-organizer");
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
Reference in New Issue
Block a user