Skip to main content

Module query

Module query 

Source
Expand description

SQLite query helpers for the projection database.

Provides typed Rust structs and composable query functions for common access patterns: list/filter items, get by ID, search FTS5, retrieve dependencies, labels, assignees, and comments.

All functions take a shared &Connection reference and return anyhow::Result<T> with typed structs (never raw rows).

Structs§

ItemFilter
Filter criteria for item listings.
LabelCount
Global label inventory row with usage count.
ProjectStats
Aggregate counters for project-level stats used by reporting commands.
QueryAssignee
An assignee of an item.
QueryComment
A comment attached to a work item.
QueryDependency
A dependency edge between two items.
QueryItem
A projected work item row from the items table.
QueryLabel
A label attached to an item.
SearchHit
An FTS5 search hit with BM25 relevance score.

Enums§

SortOrder
Sort order for item listings.

Functions§

count_items
Count items matching the given filter criteria.
event_counts_by_agent
Count projected events by agent from projected_events.
event_counts_by_type
Count projected events by event_type from projected_events.
get_assignees
Get all assignees for an item.
get_children
Get child items of the given parent item.
get_comments
Get all comments for an item, newest first.
get_dependencies
Get items that a given item depends on (its blockers).
get_dependents
Get items that depend on the given item (its dependents / reverse deps).
get_item
Fetch a single item by exact item_id.
get_labels
Get all labels for an item.
get_projection_cursor
Get the projection cursor metadata (last replay offset and hash).
item_counts_by_kind
Count projected items grouped by kind, excluding deleted rows.
item_counts_by_state
Count projected items grouped by state, excluding deleted rows.
item_counts_by_urgency
Count projected items grouped by urgency, excluding deleted rows.
item_exists
Check if an item exists in the projection.
list_items
List items matching the given filter criteria.
list_labels
List global label usage counts across all items.
search
Search items via FTS5 full-text search with BM25 ranking.
try_open_projection
Attempt to open the projection database with graceful recovery.
update_projection_cursor
Update the projection cursor after replaying events.