pub struct Node {
pub id: NodeId,
pub version: u64,
pub labels: HashSet<Label>,
pub properties: HashMap<String, PropertyValue>,
pub created_at: i64,
pub updated_at: i64,
}Expand description
A node in the property graph
Nodes can have:
- A unique ID
- Multiple labels (REQ-GRAPH-006)
- Properties (key-value pairs)
- Creation and update timestamps
Fields§
§id: NodeIdUnique identifier for this node
version: u64Version for MVCC
labels: HashSet<Label>Set of labels for this node (supports multiple labels)
properties: HashMap<String, PropertyValue>Properties associated with this node
created_at: i64Creation timestamp (Unix milliseconds)
updated_at: i64Last update timestamp (Unix milliseconds)
Implementations§
Source§impl Node
impl Node
Sourcepub fn new_with_labels(id: NodeId, labels: Vec<Label>) -> Node
pub fn new_with_labels(id: NodeId, labels: Vec<Label>) -> Node
Create a new node with multiple labels (REQ-GRAPH-006)
Sourcepub fn new_with_properties(
id: NodeId,
labels: Vec<Label>,
properties: HashMap<String, PropertyValue>,
) -> Node
pub fn new_with_properties( id: NodeId, labels: Vec<Label>, properties: HashMap<String, PropertyValue>, ) -> Node
Create a new node with labels and properties
Sourcepub fn remove_label(&mut self, label: &Label) -> bool
pub fn remove_label(&mut self, label: &Label) -> bool
Remove a label from this node
Sourcepub fn get_labels(&self) -> Vec<&Label>
pub fn get_labels(&self) -> Vec<&Label>
Get all labels
Sourcepub fn set_property(
&mut self,
key: impl Into<String>,
value: impl Into<PropertyValue>,
) -> Option<PropertyValue>
pub fn set_property( &mut self, key: impl Into<String>, value: impl Into<PropertyValue>, ) -> Option<PropertyValue>
Set a property value
Sourcepub fn get_property(&self, key: &str) -> Option<&PropertyValue>
pub fn get_property(&self, key: &str) -> Option<&PropertyValue>
Get a property value
Sourcepub fn remove_property(&mut self, key: &str) -> Option<PropertyValue>
pub fn remove_property(&mut self, key: &str) -> Option<PropertyValue>
Remove a property
Sourcepub fn has_property(&self, key: &str) -> bool
pub fn has_property(&self, key: &str) -> bool
Check if property exists
Sourcepub fn property_count(&self) -> usize
pub fn property_count(&self) -> usize
Get number of properties
Sourcepub fn label_count(&self) -> usize
pub fn label_count(&self) -> usize
Get number of labels
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Node, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Node, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Node
impl Serialize for Node
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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