diff options
author | Joris | 2022-01-09 09:43:21 +0100 |
---|---|---|
committer | Joris | 2022-01-09 10:11:29 +0100 |
commit | bd59a5128c05dcd550e91bbdd0cd9d5996a65586 (patch) | |
tree | 541f7d49253ad3e7c8dfab480f33a2b10107b0d2 /src/main.rs | |
parent | ce978143f1360e16e85587644055a9f83d11c64c (diff) |
Persist events to sqlite db
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/src/main.rs b/src/main.rs index 9dbed82..f30e38e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,59 +1,10 @@ mod app; mod model; +mod db; -use chrono::{NaiveDate, NaiveTime}; +use anyhow::Result; -use crate::model::event::{Event, Time}; - -fn main() { - let events = test_events(); - app::run(events) -} - -fn test_events() -> Vec<Event> { - [ - Event { - date: NaiveDate::from_ymd(2021, 11, 29), - time: Time::AllDay, - name: "Début de la semaine".to_string(), - }, - Event { - date: NaiveDate::from_ymd(2021, 12, 4), - time: Time::AllDay, - name: "Fin de la semaine".to_string(), - }, - Event { - date: NaiveDate::from_ymd(2021, 12, 4), - time: Time::Time { - start: NaiveTime::from_hms(15, 0, 0), - end: Some(NaiveTime::from_hms(15, 30, 0)), - }, - name: "Appel".to_string(), - }, - Event { - date: NaiveDate::from_ymd(2021, 12, 4), - time: Time::Time { - start: NaiveTime::from_hms(12, 0, 0), - end: Some(NaiveTime::from_hms(14, 0, 0)), - }, - name: "Repas".to_string(), - }, - Event { - date: NaiveDate::from_ymd(2021, 12, 4), - time: Time::Time { - start: NaiveTime::from_hms(8, 0, 0), - end: None, - }, - name: "Promener le chien".to_string(), - }, - Event { - date: NaiveDate::from_ymd(2021, 12, 4), - time: Time::Time { - start: NaiveTime::from_hms(9, 0, 0), - end: None, - }, - name: "Thé".to_string(), - }, - ] - .to_vec() +fn main() -> Result<()> { + let conn = db::init()?; + Ok(app::run(conn)) } |