pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub fn open() -> Result<Self>
pub fn load_app_data(&self) -> Result<AppData>
pub fn save_app_data(&self, data: &AppData) -> Result<()>
pub fn insert_focus_session(&self, record: &FocusSessionRecord) -> Result<i64>
pub fn get_session(&self, id: i64) -> Result<StoredSession>
pub fn delete_focus_session(&self, id: i64) -> Result<()>
pub fn update_session_minutes(&self, id: i64, minutes: u32) -> Result<()>
pub fn recent_sessions(&self, limit: usize) -> Result<Vec<StoredSession>>
pub fn recent_sessions_paged( &self, offset: usize, limit: usize, ) -> Result<Vec<StoredSession>>
pub fn session_count(&self) -> Result<usize>
pub fn sessions_on_date(&self, date: &str) -> Result<Vec<StoredSession>>
pub fn session_counts_by_mode(&self) -> Result<(u32, u32, u32)>
pub fn load_timer_state(&self) -> (u32, TimerMode)
pub fn persist_timer_state(&self, completed: u32, mode: TimerMode) -> Result<()>
pub fn set_setting(&self, key: &str, value: impl AsRef<str>) -> Result<()>
pub fn upsert_task(&self, task: &Task) -> Result<()>
pub fn delete_task(&self, id: u64) -> Result<()>
pub fn sync_sort_orders(&self, tasks: &[Task]) -> Result<()>
pub fn persist_session_stats(&self, data: &AppData) -> Result<()>
pub fn persist_timer_settings(&self, data: &AppData) -> Result<()>
pub fn persist_active_task(&self, id: Option<u64>) -> Result<()>
pub fn export_json(&self) -> Result<PathBuf>
pub fn minutes_by_date(&self, days: usize) -> Result<Vec<(String, u32)>>
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl !Sync for Database
impl !UnwindSafe for Database
impl Send for Database
impl Unpin for Database
impl UnsafeUnpin for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more