Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Flatten ¶
func Flatten(inputJSON interface{}) map[string]interface{}
Flatten accepts a nested struct and returns a flat struct with key like a.'b/c'.d[0].e
func PrintFlat ¶
func PrintFlat(b []byte)
PrintFlat accepts a JSON formated byte array and prints to stdout the sorted "key = val"
func RelaxedJSONPathExpression ¶
RelaxedJSONPathExpression attempts to be flexible with JSONPath expressions, it accepts:
- metadata.name (no leading '.' or curly braces '{...}'
- {metadata.name} (no leading '.')
- .metadata.name (no curly braces '{...}')
- {.metadata.name} (complete expression)
And transforms them all into a valid jsonpath expression:
{.metadata.name}
func SprintFlat ¶
SprintFlat accepts a JSON formated byte array and returns the sorted "key = val" buffer
func SprintFlatColor ¶
func SprintFlatColor(b []byte, colorize *palette.ColorPaletteFunc) string
Types ¶
type RenderFunc ¶
type RenderFunc func() string
RenderFunc is the protype of human format renderer functions.
type Renderer ¶
type Renderer struct { DefaultOutput string Output string Color string Data any HumanRenderer RenderFunc Colorize *palette.ColorPaletteFunc Stream bool }
Renderer hosts the renderer options and data, and exposes the rendering method.
type T ¶
type T int
T encodes as an integer one of the supported output formats (json, flat, human, table, csv)
const ( // Human is the prefered human friendly custom output format Human T = iota // JSON is the json output format JSON // Flat is the flattened json output format (a.'b#b'.c = d, a[0] = b) Flat // JSONLine is unindented json output format JSONLine // Tab is the customizable tabular output format Tab // Table is the simple tabular output format Table // CSV is the csv tabular output format CSV // YAML is the standard human readable, commentable, complex data representation YAML )
func (T) MarshalText ¶
MarshalText marshals the enum as a quoted json string
func (*T) UnmarshalText ¶
UnmarshalText unmashals a quoted json string to the enum value