Skip to main content

Module tree

Module tree 

Source
Available on crate feature transform-tree-flatten only.
Expand description

Recursive report-tree / matrix flatten transform (tree_flatten, #530).

Financial-report APIs (QuickBooks / Xero / ZohoBooks / Rillet, and Sage/Intacct) return a self-referential nested-Rows matrix — a tree of section → subsection → line, where the tabular output is one row per leaf carrying the section labels it sits under plus the period columns. Flattening it is the one reshape that kept those taps on the embedded-DuckDB SQL path; tree_flatten moves them back to an inbuilt transform.

Pure + recursive: a depth-first walk carrying an ancestor-label stack; at each leaf it emits { <ancestor columns…>, <header→value columns…>, [path] }. It routes through TransformStage::Custom (1→0..N), so no new stage-enum variant is needed (the exhaustive-enum rule).

Structs§

AncestorsSpec
Which ancestor labels to carry down onto each emitted row.
ColumnsSpec
How the value columns are read from a leaf node.
CompiledTreeFlatten
Validated TreeFlattenSpec — apply per record with CompiledTreeFlatten::apply.
TreeFlattenSpec
Spec for the tree_flatten transform — recursive tree/matrix → leaf rows (1→0..N). Compile with TreeFlattenSpec::compile; attach via TreeFlattenSpec::into_stage.

Constants§

DEFAULT_MAX_DEPTH
Default TreeFlattenSpec::max_depth — a stack-overflow backstop for a malformed or cyclic tree, far above any real report nesting.