pg_jsonl/types.rs
1//! Owned records produced by the parser.
2
3/// A property-graph node.
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct Node {
6 /// The node's identifier, as written in the file.
7 pub id: String,
8 /// Zero or more labels.
9 pub labels: Vec<String>,
10 /// Properties in file order.
11 pub properties: Vec<Property>,
12}
13
14/// A property-graph edge (relationship).
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub struct Edge {
17 /// The edge's own identifier, when the file carries one.
18 pub id: Option<String>,
19 /// The source (start) node identifier.
20 pub source: String,
21 /// The target (end) node identifier.
22 pub target: String,
23 /// The relationship type / label.
24 pub label: String,
25 /// Properties in file order.
26 pub properties: Vec<Property>,
27}
28
29/// One property with its value rendered as text and the JSON type it
30/// came from as a hint.
31#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct Property {
33 /// Property name.
34 pub name: String,
35 /// The value as text: strings verbatim, numbers and booleans in
36 /// their JSON spelling, arrays and objects as compact JSON.
37 pub value: String,
38 /// The JSON type: `string`, `int`, `float`, `boolean`, or `json`
39 /// for arrays and objects.
40 pub type_hint: Option<String>,
41}