tyneq / QueryPlanPrinter
Class: QueryPlanPrinter
Defined in: src/queryplan/QueryPlanPrinter.ts:23
Converts a query plan tree into a human-readable multi-line string.
Implements QueryPlanVisitor<string>. The output lists operators from source to terminal, one per line, with indentation showing the pipeline depth.
Example
import { QueryPlanPrinter } from "tyneq/queryplan";
const seq = Tyneq.range(1, 10).where(x => x % 2 === 0).select(x => x * x);
console.log(QueryPlanPrinter.print(seq[tyneqQueryNode]!));
// range(1, 10)
// -> where(<fn>)
// -> select(<fn>)Implements
QueryPlanVisitor<string>
Constructors
Constructor
new QueryPlanPrinter(
options?):QueryPlanPrinter
Defined in: src/queryplan/QueryPlanPrinter.ts:28
Parameters
| Parameter | Type |
|---|---|
options | QueryPlanPrinterOptions |
Returns
QueryPlanPrinter
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
indent | readonly | string | src/queryplan/QueryPlanPrinter.ts:24 |
arrow | readonly | string | src/queryplan/QueryPlanPrinter.ts:25 |
maxInlineArrayItems | readonly | number | src/queryplan/QueryPlanPrinter.ts:26 |
Methods
visit()
visit(
node):string
Defined in: src/queryplan/QueryPlanPrinter.ts:35
Renders the full query plan rooted at node as a multi-line string.
Parameters
| Parameter | Type |
|---|---|
node | IQueryNode |
Returns
string
Implementation of
print()
staticprint(node,options?):string
Defined in: src/queryplan/QueryPlanPrinter.ts:41
Convenience static: creates a printer with options and calls visit(node).
Parameters
| Parameter | Type |
|---|---|
node | IQueryNode |
options? | QueryPlanPrinterOptions |
Returns
string
formatArg()
protectedformatArg(arg):string
Defined in: src/queryplan/QueryPlanPrinter.ts:49
Formats a single operator argument for display. Override to customise how arguments appear in printed plans.
Parameters
| Parameter | Type |
|---|---|
arg | unknown |
Returns
string
formatLine()
protectedformatLine(name,argStr,isRoot):string
Defined in: src/queryplan/QueryPlanPrinter.ts:71
Formats one line of the plan output. Override to customise indentation or arrow style beyond what QueryPlanPrinterOptions allows.
Parameters
| Parameter | Type |
|---|---|
name | string |
argStr | string |
isRoot | boolean |
Returns
string