Expand description
Dynamically assembles the single-statement tree query a nested repo’s
generated read fns execute at runtime: a tagged UNION ALL over one CTE
per tree node, so a parent and all of its nested children (recursively)
come back in one statement instead of one per level.
Structs§
- Tree
Query Source - The root user query plus the bits needed to fold it into the tree query.
- Tree
Spec - Static description of one node (repo) in a nested tree, used to build the query.
Functions§
- build_
tree_ query - decode_
tag - decode_
tagged_ row - Decodes a row from a tree branch with no snapshot columns (the branch’s own node has no snapshot table, and no sibling forced padding). Identical to what every tree branch decoded before snapshotting existed.
- decode_
tagged_ snapshot_ row - Decodes a row from a snapshot-enabled node’s own branch:
eventandrecorded_atmay beNULL(the lone snapshot-only row when the tail is empty), and the fivesnapshot*columns are present. - partition_
by_ tag - snapshot_
fingerprints - Walks the tree in the same DFS order
build_tree_queryassigns fingerprint bind-parameter indices in (root, then children depth-first), returning the fingerprint of every node that has a snapshot table. - tree_
has_ snapshot trueif this node or any descendant enablessnapshot. Determines whether every branch in the tree’sUNION ALLneeds the same (wider) column list — a tree with no snapshot node anywhere emits the same SQL as before this feature existed.