Skip to content

tyneq


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

ts
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

Constructors

Constructor

new QueryPlanPrinter(options?): QueryPlanPrinter

Defined in: src/queryplan/QueryPlanPrinter.ts:28

Parameters

ParameterType
optionsQueryPlanPrinterOptions

Returns

QueryPlanPrinter

Properties

PropertyModifierTypeDefined in
indentreadonlystringsrc/queryplan/QueryPlanPrinter.ts:24
arrowreadonlystringsrc/queryplan/QueryPlanPrinter.ts:25
maxInlineArrayItemsreadonlynumbersrc/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

ParameterType
nodeIQueryNode

Returns

string

Implementation of

QueryPlanVisitor.visit


print()

static print(node, options?): string

Defined in: src/queryplan/QueryPlanPrinter.ts:41

Convenience static: creates a printer with options and calls visit(node).

Parameters

ParameterType
nodeIQueryNode
options?QueryPlanPrinterOptions

Returns

string


formatArg()

protected formatArg(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

ParameterType
argunknown

Returns

string


formatLine()

protected formatLine(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

ParameterType
namestring
argStrstring
isRootboolean

Returns

string