render

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package render writes strata's answers as tables, trees, JSON, CSV, NDJSON, Mermaid, DOT, SVG and self-contained HTML. Machine formats are never styled.

Index

Constants

View Source
const (
	FormatTree = "tree"
	Mermaid    = "mermaid"
	Dot        = "dot"
	SVG        = "svg"
	HTML       = "html"
)

Graph formats.

View Source
const (
	Table  = "table"
	JSON   = "json"
	CSV    = "csv"
	NDJSON = "ndjson"
)

Formats for tabular output.

Variables

This section is empty.

Functions

func Cell

func Cell(col string, v any) string

Cell formats a value for a human-readable table.

func D2Source

func D2Source(g *graph.Graph) string

D2Source returns the graph as D2 source text.

func DotTo

func DotTo(w io.Writer, g *graph.Graph) error

DotTo writes a Graphviz DOT graph.

func Explain

func Explain(w io.Writer, ex *service.Explanation) error

Explain writes a human-readable report of one image.

func HTMLTo

func HTMLTo(w io.Writer, g *graph.Graph) error

HTMLTo writes a self-contained interactive explorer: the graph JSON plus Cytoscape.js with an ELK layout, opened offline in any browser.

func JSONTo

func JSONTo(w io.Writer, v any) error

JSONTo writes v as indented JSON.

func MapTo

func MapTo(w io.Writer, g *graph.Graph) error

MapTo writes the registry map: an icicle chart with root bases at the left and descendants to the right, each block sized by image count and shaded by its share of stale images.

func MermaidTo

func MermaidTo(w io.Writer, g *graph.Graph) error

MermaidTo writes a Mermaid flowchart, which GitHub renders inline.

func SVGTo

func SVGTo(w io.Writer, g *graph.Graph) error

SVGTo lays the graph out with D2 (embedded as a library, no Graphviz needed) and writes an SVG.

func Tree

func Tree(w io.Writer, g *graph.Graph) error

Tree writes a graph as an indented tree with aligned columns: name, short digest, then the verdict for the first node and edge provenance for the rest. Ancestry trees start at the image and descend to the root; descendant trees start at the base.

func TrendTo

func TrendTo(w io.Writer, metric string, series []Series) error

TrendTo writes a snapshot metric as a self-contained HTML line chart, drawn as inline SVG with no scripts.

func WriteGraph

func WriteGraph(w io.Writer, format string, g *graph.Graph) error

WriteGraph writes a graph in tree, mermaid, dot, svg, html or json.

func WriteRows

func WriteRows(w io.Writer, format string, cols []string, rows [][]any) error

WriteRows writes a whole table in one format.

Types

type Display

type Display struct {
	Title string `json:"title"`
	Sub   string `json:"sub"`
}

Display is how a node is named in visual formats: a title, a subtitle with its short digest and status, and the registry host, which is left out of the title when every node shares it.

type RowWriter

type RowWriter interface {
	// Header is called once with the column names.
	Header(cols []string) error
	// Row writes one row.
	Row(vals []any) error
	// Close flushes buffered output.
	Close() error
}

RowWriter streams rows in one format.

func NewRowWriter

func NewRowWriter(w io.Writer, format string) (RowWriter, error)

NewRowWriter returns a writer for table, json, csv or ndjson.

type Series

type Series struct {
	Name   string
	Days   []string
	Values []float64
}

Series is one line of a trend chart.

type View

type View struct {
	Graph   *graph.Graph       `json:"graph"`
	Host    string             `json:"host"`
	Display map[string]Display `json:"display"`
}

View is the data a visual format draws: the graph plus each node's display text and the shared registry host, if any.

func NewView

func NewView(g *graph.Graph) View

NewView names every node for display.

Jump to

Keyboard shortcuts

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