upsert_document

Function upsert_document 

Source
async fn upsert_document(pool: &SqlitePool, item: &SourceItem) -> Result<String>
Expand description

Inserts or updates a document in the documents table.

Computes a SHA-256 deduplication hash from the item’s source, source_id, updated_at timestamp, and body. If a document with the same (source, source_id) already exists, it is updated with the new data; otherwise a new UUID is assigned.

§Returns

The document’s UUID (existing or newly generated).