writer

package
v0.0.0-...-c1eb6af Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 12 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
	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 JsonWriter

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

func (JsonWriter) Write

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 bool, terraformState terraform_state.TerraformState) Writer

func NewJsonWriter

func NewJsonWriter(changes terraform_state.ResourceChanges) Writer

func NewSeparateTree

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

func NewTableWriter

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

func NewTreeWriter

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

Jump to

Keyboard shortcuts

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