First try of implementing database

This commit is contained in:
2024-02-02 09:18:45 +01:00
parent 7217ce8bc1
commit 4b6418c23a
6 changed files with 1284 additions and 20 deletions

View File

@@ -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();