pub struct GraphStore { /* private fields */ }Expand description
In-memory graph store.
Implementations§
Source§impl GraphStore
impl GraphStore
pub fn new() -> Self
pub fn with_data_dir(data_dir: Option<PathBuf>) -> Self
Sourcepub fn create_node(&self, label: &str, properties: Value) -> GraphNode
pub fn create_node(&self, label: &str, properties: Value) -> GraphNode
Create a new node.
Sourcepub fn create_edge(
&self,
source: &str,
target: &str,
relationship: &str,
) -> Result<GraphEdge, String>
pub fn create_edge( &self, source: &str, target: &str, relationship: &str, ) -> Result<GraphEdge, String>
Create a new edge between nodes.
Sourcepub fn delete_node(&self, id: &str) -> Result<(), String>
pub fn delete_node(&self, id: &str) -> Result<(), String>
Delete a node and its edges. Lock order: nodes first, then edges (consistent with create_edge).
Sourcepub fn list_nodes(&self) -> Vec<GraphNode>
pub fn list_nodes(&self) -> Vec<GraphNode>
List all nodes.
Sourcepub fn list_edges(&self) -> Vec<GraphEdge>
pub fn list_edges(&self) -> Vec<GraphEdge>
List all edges.
Sourcepub fn find_by_label(&self, label: &str) -> Vec<GraphNode>
pub fn find_by_label(&self, label: &str) -> Vec<GraphNode>
Search nodes by label.
Sourcepub fn get_edges_for_node(&self, node_id: &str) -> Vec<GraphEdge>
pub fn get_edges_for_node(&self, node_id: &str) -> Vec<GraphEdge>
Get edges for a node.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GraphStore
impl !RefUnwindSafe for GraphStore
impl Send for GraphStore
impl Sync for GraphStore
impl Unpin for GraphStore
impl UnsafeUnpin for GraphStore
impl UnwindSafe for GraphStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more