Skip to main content

link_transcript

Function link_transcript 

Source
pub fn link_transcript(
    conn: &Connection,
    memory_id: &str,
    transcript_id: &str,
    span_start: Option<i64>,
    span_end: Option<i64>,
) -> Result<()>
Expand description

Insert (or replace) a provenance edge between a memory and a transcript. Both ids must already exist in their respective tables — the foreign keys are enforced (PRAGMA foreign_keys = ON is set on every connection opened by crate::db::open).

Uses INSERT OR REPLACE so re-linking the same (memory_id, transcript_id) pair with a different span is a no-fuss update; the I-track currently has no caller that needs to detect the duplicate.

§Errors

Returns an error when the INSERT fails — most commonly a foreign-key violation (one of the ids is unknown or has been deleted), or a disk-write failure.