Skip to main content

Module db

Module db 

Source
Expand description

SQLite database layer — schema, CRUD, FTS, and link storage.

All functions take a &Connection (no global state). The database lives at <vault>/.lore/lore.db and is opened via open_db.

Structs§

LinkRow
A row from the links table.
PageRow
A row from the pages table.

Functions§

delete_fts
Delete a page’s FTS entry.
delete_links_from
Delete all links originating from a source slug.
delete_page
Delete a page and its associated links and FTS entry.
get_all_hashes
Get all content hashes for diffing: slug -> hash.
get_all_pages
Get all pages sorted by title.
get_all_slugs
Get all known slugs as a set (for checking page existence).
get_backlinks
Get backlinks: all pages that link TO a given slug.
get_outgoing_targets
Get all outgoing link target slugs for a given source page.
get_page
Get a page by slug.
insert_links
Insert a batch of links.
open_db
Open or create the SQLite database inside <vault>/.lore/.
rename_page
Rename a page: update its slug/title and all links that reference it.
update_fts
Update FTS index for a page.
upsert_page
Upsert a page (insert or update on slug conflict).