Skip to main content

nova_boot_graphdb/
types.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value as JsonValue;
3use std::collections::HashMap;
4
5/// Represents a graph node with labels and arbitrary properties.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct GraphNode {
8    pub id: String,
9    pub labels: Vec<String>,
10    pub properties: HashMap<String, JsonValue>,
11}
12
13/// Represents an edge between two nodes.
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15pub struct GraphEdge {
16    pub id: String,
17    pub from: String,
18    pub to: String,
19    pub rel_type: String,
20    pub properties: HashMap<String, JsonValue>,
21}
22
23/// A subgraph containing nodes and edges returned by traversals.
24#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
25pub struct GraphSubgraph {
26    pub nodes: Vec<GraphNode>,
27    pub edges: Vec<GraphEdge>,
28}
29
30/// Supported query types for the adapters.
31#[derive(Debug, Clone, PartialEq, Eq)]
32pub enum GraphQuery {
33    Cypher(String),
34    GraphQl(String),
35}