Skip to main content

Module db

Module db 

Source
Expand description

SQLite persistence layer: one module per entity, migrations on open.

use kasl::db::{db::Db, tasks::Tasks, workdays::Workdays};
use kasl::libs::task::Task;

let db = Db::new()?;
let mut tasks = Tasks::new()?;
let task = Task::new("Review code", "Check PR #123", Some(75));
tasks.insert(&task)?;
use kasl::db::{tags::{Tags, Tag}, templates::{Templates, TaskTemplate}};

let mut tags = Tags::new()?;
let tag_id = tags.create(&Tag::new("urgent".to_string(), Some("red".to_string())))?;

let mut templates = Templates::new()?;
let template = TaskTemplate::new(
    "daily-standup".to_string(),
    "Attend daily standup meeting".to_string(),
    "Team sync and planning".to_string(),
    100
);
templates.create(&template)?;

Modules§

db
Connection handling and schema bootstrap. Database connection bootstrap: path resolution, pragmas, migrations.
jira_inbox
Local inbox of assigned open Jira issues. Persistent store for discovered Jira inbox issues.
jira_statuses
Catalog of Jira status id → name pairs synced from issues. Local catalog of Jira workflow statuses (id → name).
migrations
Versioned schema migrations. Database schema migration management and versioning system.
pauses
Pause records detected by the monitor or entered by hand. Database operations for tracking pause periods.
tags
Tags and their task associations. Tags and the task_tags junction table linking them to tasks.
tasks
Task CRUD and filtered queries. Task table access: CRUD plus the filtered queries behind TaskFilter.
templates
Reusable task templates. Reusable task templates: named blueprints tasks are created from.
workdays
Workday start/end records. Workday records: one row per calendar date, start and optional end.