Documentation
¶
Overview ¶
Package reference provides a reference implementation for rendering Spanner query plans as ASCII tables with various formatting options.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderTreeTable ¶
func RenderTreeTable(planNodes []*sppb.PlanNode, mode RenderMode, format Format, wrapWidth int) (string, error)
RenderTreeTable renders Spanner plan nodes as an ASCII table. It supports different render modes (AUTO, PLAN, PROFILE) and formats (TRADITIONAL, CURRENT, COMPACT). The wrapWidth parameter controls text wrapping (0 disables wrapping).
func RenderTreeTableWithOptions ¶ added in v0.1.5
func RenderTreeTableWithOptions(planNodes []*sppb.PlanNode, mode RenderMode, format Format, opts ...Option) (string, error)
RenderTreeTableWithOptions renders Spanner plan nodes as an ASCII table with optional rendering configuration.
Types ¶
type Format ¶
type Format string
Format specifies the formatting style for the query plan output.
const ( // FormatTraditional uses raw metadata format in node titles. FormatTraditional Format = "TRADITIONAL" // FormatCurrent uses modern formatting with labels and angle brackets. FormatCurrent Format = "CURRENT" // FormatCompact uses compact tree rendering with minimal spacing. FormatCompact Format = "COMPACT" )
func ParseFormat ¶
ParseFormat parses a string into a Format. Valid values are "TRADITIONAL", "CURRENT", and "COMPACT" (case-insensitive).
type Option ¶ added in v0.1.5
type Option func(*options)
Option configures optional rendering behavior for RenderTreeTableWithOptions.
func WithHangingIndent ¶ added in v0.1.5
func WithHangingIndent() Option
WithHangingIndent hangs wrapped continuation lines after node-local prefixes such as `[Input] ` and `[Map] ` instead of keeping the default tree-aligned indentation.
func WithWrapWidth ¶ added in v0.1.5
WithWrapWidth sets the maximum total rendered line width, including the tree prefix. A value of 0 disables wrapping. Negative values make RenderTreeTableWithOptions return an error.
type RenderMode ¶
type RenderMode string
RenderMode specifies how to render the query plan output.
const ( // RenderModeAuto automatically determines whether to show statistics based on availability. RenderModeAuto RenderMode = "AUTO" // RenderModePlan shows only the query plan without statistics. RenderModePlan RenderMode = "PLAN" // RenderModeProfile shows the query plan with execution statistics. RenderModeProfile RenderMode = "PROFILE" )
func ParseRenderMode ¶
func ParseRenderMode(s string) (RenderMode, error)
ParseRenderMode parses a string into a RenderMode. Valid values are "AUTO", "PLAN", and "PROFILE" (case-insensitive).