writer

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package prettyjson provides JSON pretty print. Below code is Inspired from https://github.com/hokaccha/go-prettyjson

Index

Constants

View Source
const SEPARATOR = "###################"

Variables

This section is empty.

Functions

func Format

func Format(data []byte) ([]byte, error)

Format JSON string with default options.

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal JSON data with default options.

Types

type Formatter

type Formatter struct {
	AddColor        *color.Color
	RemoveColor     *color.Color
	UpdateColor     *color.Color
	RecreateColor   *color.Color
	ImportColor     *color.Color
	StringMaxLength int
	Indent          int
	Newline         string
}

func NewFormatter

func NewFormatter() *Formatter

NewFormatter returns a new formatter with following default values.

func (*Formatter) Format

func (f *Formatter) Format(data []byte) ([]byte, error)

Format formats JSON string.

func (*Formatter) Marshal

func (f *Formatter) Marshal(v interface{}) ([]byte, error)

Marshal marshals and formats JSON data.

type HTMLWriter added in v0.3.8

type HTMLWriter struct {
	ResourceChanges map[string]terraformstate.ResourceChanges
	OutputChanges   map[string][]string
}

HTMLWriter is a Writer that writes HTML.

func (HTMLWriter) Write added in v0.3.8

func (t HTMLWriter) Write(writer io.Writer) error

Write outputs the HTML summary to the io.Writer it's passed.

type JSONWriter added in v0.3.0

type JSONWriter struct {
	// contains filtered or unexported fields
}

func (JSONWriter) Write added in v0.3.0

func (t JSONWriter) Write(writer io.Writer) error

type SeparateTree

type SeparateTree struct {
	// contains filtered or unexported fields
}

func (SeparateTree) Write

func (s SeparateTree) Write(writer io.Writer) error

type TableWriter

type TableWriter struct {
	// contains filtered or unexported fields
}

func (TableWriter) Write

func (t TableWriter) Write(writer io.Writer) error

type TreeWriter

type TreeWriter struct {
	// contains filtered or unexported fields
}

func (TreeWriter) Write

func (t TreeWriter) Write(writer io.Writer) error

type Writer

type Writer interface {
	Write(writer io.Writer) error
}

func CreateWriter

func CreateWriter(tree, separateTree, drawable, mdEnabled, json, html bool, plan tfjson.Plan) Writer

func NewHTMLWriter added in v0.3.8

func NewHTMLWriter(changes map[string]terraformstate.ResourceChanges, outputChanges map[string][]string) Writer

NewHTMLWriter returns a new HTMLWriter with the configuration it's passed.

func NewJSONWriter added in v0.3.0

func NewJSONWriter(changes terraformstate.ResourceChanges) Writer

func NewSeparateTree

func NewSeparateTree(changes map[string]terraformstate.ResourceChanges, drawable bool) Writer

func NewTableWriter

func NewTableWriter(changes map[string]terraformstate.ResourceChanges, outputChanges map[string][]string, mdEnabled bool) Writer

func NewTreeWriter

func NewTreeWriter(changes terraformstate.ResourceChanges, drawable bool) Writer

Jump to

Keyboard shortcuts

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