pub struct RelationshipGenerator { /* private fields */ }Expand description
Generator for relationships between entities.
Implementations§
Source§impl RelationshipGenerator
impl RelationshipGenerator
Sourcepub fn new(config: RelationshipConfig, seed: u64) -> Self
pub fn new(config: RelationshipConfig, seed: u64) -> Self
Creates a new relationship generator.
Sourcepub fn with_defaults(seed: u64) -> Self
pub fn with_defaults(seed: u64) -> Self
Creates a generator with default configuration.
Sourcepub fn generate_relationships(
&mut self,
nodes: &[NodeRef],
) -> Vec<GeneratedRelationship>
pub fn generate_relationships( &mut self, nodes: &[NodeRef], ) -> Vec<GeneratedRelationship>
Generates relationships for a set of nodes.
Sourcepub fn generate_for_node(
&mut self,
node: &NodeRef,
available_targets: &HashMap<String, Vec<NodeRef>>,
) -> Vec<GeneratedRelationship>
pub fn generate_for_node( &mut self, node: &NodeRef, available_targets: &HashMap<String, Vec<NodeRef>>, ) -> Vec<GeneratedRelationship>
Generates relationships for a single node.
Sourcepub fn check_cardinality(
&self,
source_id: &str,
target_id: &str,
rel_type: &str,
) -> RelationshipValidation
pub fn check_cardinality( &self, source_id: &str, target_id: &str, rel_type: &str, ) -> RelationshipValidation
Checks if a relationship would create a valid cardinality.
Sourcepub fn check_circular(&mut self, source_id: &str, target_id: &str) -> bool
pub fn check_circular(&mut self, source_id: &str, target_id: &str) -> bool
Checks if a relationship would create a circular reference.
Sourcepub fn config(&self) -> &RelationshipConfig
pub fn config(&self) -> &RelationshipConfig
Returns the configuration.
Auto Trait Implementations§
impl Freeze for RelationshipGenerator
impl RefUnwindSafe for RelationshipGenerator
impl Send for RelationshipGenerator
impl Sync for RelationshipGenerator
impl Unpin for RelationshipGenerator
impl UnwindSafe for RelationshipGenerator
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