pub struct LineageNode {
pub name: String,
pub expression: Option<Expr>,
pub source_name: Option<String>,
pub source: Option<Expr>,
pub downstream: Vec<LineageNode>,
pub alias: Option<String>,
pub depth: usize,
}Expand description
A node in the lineage graph representing a column or expression.
Fields§
§name: StringThe name of this column/expression (e.g., “a”, “SUM(b)”, “t.col”).
expression: Option<Expr>The AST expression this node represents.
source_name: Option<String>The source table/CTE/subquery name, if applicable.
source: Option<Expr>Reference to the source AST (for complex expressions).
downstream: Vec<LineageNode>Child nodes (upstream lineage - where data comes from).
alias: Option<String>The alias, if this is an aliased expression.
depth: usizeDepth in the lineage graph (0 = root output column).
Implementations§
Source§impl LineageNode
impl LineageNode
Sourcepub fn with_source(self, source_name: String) -> Self
pub fn with_source(self, source_name: String) -> Self
Create a node with source information.
Sourcepub fn with_expression(self, expr: Expr) -> Self
pub fn with_expression(self, expr: Expr) -> Self
Create a node with an expression.
Sourcepub fn with_alias(self, alias: String) -> Self
pub fn with_alias(self, alias: String) -> Self
Create a node with an alias.
Sourcepub fn with_depth(self, depth: usize) -> Self
pub fn with_depth(self, depth: usize) -> Self
Create a node with depth.
Sourcepub fn add_downstream(&mut self, node: LineageNode)
pub fn add_downstream(&mut self, node: LineageNode)
Add a downstream (upstream lineage) node.
Sourcepub fn walk<F>(&self, visitor: &mut F)where
F: FnMut(&LineageNode),
pub fn walk<F>(&self, visitor: &mut F)where
F: FnMut(&LineageNode),
Walk through all nodes in the lineage graph (pre-order).
Sourcepub fn iter(&self) -> LineageIterator<'_> ⓘ
pub fn iter(&self) -> LineageIterator<'_> ⓘ
Iterate over all nodes in the lineage graph.
Sourcepub fn source_columns(&self) -> Vec<&LineageNode>
pub fn source_columns(&self) -> Vec<&LineageNode>
Get all source columns (leaf nodes) in this lineage.
Sourcepub fn source_tables(&self) -> Vec<String>
pub fn source_tables(&self) -> Vec<String>
Get all source table names referenced in this lineage.
Sourcepub fn to_mermaid(&self) -> String
pub fn to_mermaid(&self) -> String
Generate Mermaid diagram representation.
Trait Implementations§
Source§impl Clone for LineageNode
impl Clone for LineageNode
Source§fn clone(&self) -> LineageNode
fn clone(&self) -> LineageNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more