dump

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 11 Imported by: 18

Documentation

Overview

Package dump contains functions used to print documents to JSON, YAML and Table formats

Index

Constants

View Source
const (
	JSONFormat  = "json"
	YAMLFormat  = "yaml"
	YMLFormat   = "yml"
	EmptyFormat = ""
)

Variables

This section is empty.

Functions

func Formatted

func Formatted(writer io.Writer, format string, data interface{}) error

Formatted prints the given data to the given format

func JSON

func JSON(stream io.Writer, body []byte) error

JSON dumps the given data to the given stream so that it looks pretty. If the data is a valid JSON document then it will be indented before printing it. If the `jq` tool is available in the path then it will be used for syntax highlighting.

func Table

func Table(stream io.Writer, in interface{})

Table prints the given data into a formatted table. Only properties that have a `header` tag will be printed. See https://github.com/lensesio/tableprinter

func YAML

func YAML(stream io.Writer, body []byte) error

YAML dumps the given data to the given stream so that it looks pretty. If the data is a valid YAML document then it will be indented before printing it. If the `yq` tool is available in the path then it will be used for syntax highlighting.

Types

This section is empty.

Jump to

Keyboard shortcuts

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