jsonformatter

package
v2.40.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOutputFormatters

func WithOutputFormatters(w io.Writer, input []byte, out bool, formatters ...OutputFormatter) []byte

WithOutputFormatters applies given formatters to byte array

Types

type ByteFormatter

type ByteFormatter func([]byte) []byte

ByteFormatter formats/transforms a byte array

type OutputFormatter

type OutputFormatter func(io.Writer, []byte) []byte

OutputFormatter formats/transforms a byte array

func WithFileOutput

func WithFileOutput(enabled bool, filename string, append bool) OutputFormatter

WithFileOutput writes the response to file if enabled

func WithJSONStreamOutput

func WithJSONStreamOutput(enabled bool, stream bool, isText bool) OutputFormatter

WithJSONStreamOutput converts json to json lines so it can be processed in the pipe

func WithOptionalFormatter

func WithOptionalFormatter(enabled bool, formatter ByteFormatter) OutputFormatter

WithOptionalFormatter formatter which is only applied if it is enabled

func WithSuffix

func WithSuffix(enabled bool, suffix string) OutputFormatter

WithSuffix adds an optional suffix to the output

func WithTrimSpace

func WithTrimSpace(enabled bool) OutputFormatter

WithTrimSpace formatts the json into more human friendly format

Jump to

Keyboard shortcuts

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