Skip to main content

sqlite_graphrag/storage/memories/
mod.rs

1//! Persistence layer for the `memories` table and its vector companion.
2//!
3//! Functions here encapsulate every SQL statement touching `memories`,
4//! `memory_embeddings` and the FTS5 `fts_memories` shadow table. Callers receive
5//! typed [`MemoryRow`] or [`NewMemory`] values and never build SQL strings.
6//!
7//! One submodule per storage surface: `rows` holds the typed shapes, `crud`
8//! the single-row lookups and mutations, `listing` the paginated reads,
9//! `vectors` the `memory_embeddings` companion and its KNN query, `fts` the
10//! FTS5 shadow table, and [`soft_delete`] the tombstone lifecycle.
11
12mod crud;
13mod fts;
14mod listing;
15mod rows;
16mod soft_delete;
17mod vectors;
18
19pub use crud::{find_by_hash, find_by_name, insert, read_by_name, read_full, update};
20pub use fts::{fts_search, sync_fts_after_update};
21pub use listing::{count, list};
22pub use rows::{MemoryRow, NewMemory};
23pub use soft_delete::{clear_deleted_at, find_by_name_any_state, list_deleted_before, soft_delete};
24pub use vectors::{delete_vec, knn_search, upsert_vec};
25
26#[cfg(test)]
27mod tests;