dump

package
v0.27.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

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"
)

Variables

This section is empty.

Functions

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 PrintDataInFormat added in v0.27.0

func PrintDataInFormat(format string, data interface{}, writter io.Writer)

PrintDataInFormat prints the given data to the given format

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