Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { // ID is a unique identifier for the node. ID string // Name is the display name of the node. Name string // Properties contains a list of key-value properties associated with the node. Properties []Property // Children are child nodes of the node. Children []*Node // Comments, like Children, are child nodes of the node, with the difference // that comments are indented a level deeper than children. A common use-case // for comments are tree-style properties of a node, such as expressions of a // physical plan node. Comments []*Node }
Node represents a node in a tree structure that can be traversed and printed by the Printer. It allows for building hierarchical representations of data where each node can have multiple properties and multiple children.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer is used for writing the hierarchical representation of a tree of [Node]s.
func NewPrinter ¶
func NewPrinter(w io.StringWriter) *Printer
NewPrinter creates a new Printer instance that writes to the specified io.StringWriter.
func (*Printer) Print ¶
Print writes the entire tree structure starting from the given root node to the printer's io.StringWriter. Example output:
SortMerge #sort order=ASC column=timestamp ├── Limit #limit1 limit=1000 │ └── DataObjScan #scan1 location=dataobj_1 └── Limit #limit2 limit=1000 └── DataObjScan #scan2 location=dataobj_2
type Property ¶
type Property struct { // Key is the name of the property. Key string // Values holds the value(s) of the property. Values []any // IsMultiValue marks whether the property is a multi-value property. IsMultiValue bool }
Property represents a property of a Node. It is a key-value-pair, where the value is either a single value or a list of values. When the value is a multi-value, the field IsMultiValue needs to be set to `true`. A single-value property is represented as `key=value` and a multi-value property as `key=(value1, value2, ...)`.