breaking(sqlite): Add metadata into calendar store for more efficient queries in the future

This commit is contained in:
Lennart
2025-01-15 21:33:25 +01:00
parent e6c09074d3
commit 808deabad3
8 changed files with 85 additions and 37 deletions

View File

@@ -8,9 +8,9 @@ use std::{collections::HashMap, io::BufReader};
#[derive(Debug, Clone)]
// specified in https://datatracker.ietf.org/doc/html/rfc5545#section-3.6
pub enum CalendarObjectType {
Event,
Journal,
Todo,
Event = 0,
Todo = 1,
Journal = 2,
}
#[derive(Debug, Clone)]
@@ -114,6 +114,14 @@ impl CalendarObject {
}
}
pub fn get_object_type(&self) -> CalendarObjectType {
match self.data {
CalendarObjectComponent::Todo(_) => CalendarObjectType::Todo,
CalendarObjectComponent::Event(_) => CalendarObjectType::Event,
CalendarObjectComponent::Journal(_) => CalendarObjectType::Journal,
}
}
pub fn get_first_occurence(&self) -> Result<Option<CalDateTime>, Error> {
match &self.data {
CalendarObjectComponent::Event(event) => event.get_first_occurence(),