pub struct GraphDb { /* private fields */ }Expand description
SQLite-backed code graph database.
Implementations§
Source§impl GraphDb
impl GraphDb
Sourcepub fn insert_node(&self, node: &Node) -> Result<i64>
pub fn insert_node(&self, node: &Node) -> Result<i64>
Insert a node and return its ID.
Sourcepub fn insert_batch(
&self,
nodes: &[Node],
edges: &[(i64, i64, EdgeKind)],
) -> Result<Vec<i64>>
pub fn insert_batch( &self, nodes: &[Node], edges: &[(i64, i64, EdgeKind)], ) -> Result<Vec<i64>>
Batch insert nodes and edges in a single transaction (much faster for indexing).
Sourcepub fn keyword_search(&self, query: &str) -> Result<Vec<Node>>
pub fn keyword_search(&self, query: &str) -> Result<Vec<Node>>
Full-text keyword search using FTS5 BM25 ranking.
Sourcepub fn insert_edge(&self, edge: &Edge) -> Result<()>
pub fn insert_edge(&self, edge: &Edge) -> Result<()>
Insert an edge.
Sourcepub fn search_nodes(&self, query: &str) -> Result<Vec<Node>>
pub fn search_nodes(&self, query: &str) -> Result<Vec<Node>>
Search nodes by name (case-insensitive substring match).
Sourcepub fn fuzzy_search_nodes(&self, query: &str) -> Result<Vec<Node>>
pub fn fuzzy_search_nodes(&self, query: &str) -> Result<Vec<Node>>
Fuzzy search nodes by name — ranked by match score (best first).
Sourcepub fn edges_from(&self, node_id: i64) -> Result<Vec<Edge>>
pub fn edges_from(&self, node_id: i64) -> Result<Vec<Edge>>
Get all edges from a node (outgoing relationships).
Sourcepub fn node_count(&self) -> Result<usize>
pub fn node_count(&self) -> Result<usize>
Get total node count.
Sourcepub fn edge_count(&self) -> Result<usize>
pub fn edge_count(&self) -> Result<usize>
Get total edge count.
Sourcepub fn content_hash(content: &str) -> String
pub fn content_hash(content: &str) -> String
Compute SHA-256 hash of content (first 16 hex chars).
Sourcepub fn needs_reindex(&self, file_path: &str, content: &str) -> Result<bool>
pub fn needs_reindex(&self, file_path: &str, content: &str) -> Result<bool>
Check if a file needs re-indexing (hash changed or new file).
Sourcepub fn store_file_hash(&self, file_path: &str, content: &str) -> Result<()>
pub fn store_file_hash(&self, file_path: &str, content: &str) -> Result<()>
Store file hash after indexing.
Sourcepub fn remove_file(&self, file_path: &str) -> Result<()>
pub fn remove_file(&self, file_path: &str) -> Result<()>
Remove nodes and edges for a specific file (for re-indexing).
Auto Trait Implementations§
impl !Freeze for GraphDb
impl !RefUnwindSafe for GraphDb
impl Send for GraphDb
impl !Sync for GraphDb
impl Unpin for GraphDb
impl UnsafeUnpin for GraphDb
impl !UnwindSafe for GraphDb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more