planview

package
v0.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package planview prints a plan for `kubectl ptah plan`.

Reading the plan is not this package's job: pkg/planread resolves it, reconstructs it and verifies it, and only a plan that held every check reaches Render.

A plan a newer Ptah wrote can carry fields this plugin does not read. Render never sees one, since planread.Load refuses it. RenderDisplay prints what planread.LoadForDisplay read of it, as text only, with the fields named and no value of theirs. The other formats are for a program, which would take the statements for the whole plan.

Index

Constants

This section is empty.

Variables

View Source
var Formats = []Format{Text, SQL, JSON}

Formats are the accepted values, in the order the help lists them.

Functions

func Render

func Render(out io.Writer, plan planread.Plan, format Format) error

Render writes one plan read whole in the requested format.

Every format is written from the document the store verified. The JSON one is that document unchanged rather than a re-serialization of the decoded plan, so what a reader saves still matches the content digest above it.

func RenderDisplay added in v0.2.10

func RenderDisplay(out io.Writer, plan planread.DisplayPlan) error

RenderDisplay writes a plan as text, saying what it is before what it does.

The chunk names are deliberately absent. They are how the plan is stored, not what it says, and a reader who needs them is diagnosing the store rather than reading a plan.

The statements come out as `-o sql` prints them, one at a time, each under a line that is not SQL: its place in the plan, its severity, and the reason Ptah gave. Those lines are for review, which is why `-o sql`, the format a script reads or a reviewer diffs, carries none of them.

Types

type Format

type Format string

Format is how a reader asked to see a plan.

const (
	// Text is the default: what the plan is, then each statement it holds
	// under a line that gives its severity and the reason Ptah gave.
	Text Format = "text"
	// SQL is the statements alone, for piping somewhere else. A plan this plugin
	// does not read whole has no such format, because a pipe would run it.
	SQL Format = "sql"
	// JSON is the stored document, byte for byte. A plan this plugin does not
	// read whole has no such format, because those bytes hold what it did not
	// read.
	JSON Format = "json"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL