format

package
v1.40.6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutToStdout     = "stdout"
	OutToClip       = "clip"
	OutToFilePrefix = "file:"
)

List of known output destinations.

Variables

This section is empty.

Functions

func BeautifyBytes

func BeautifyBytes(data []byte, colorify *bool) (dataStr, errStr string)

func FilterResponse

func FilterResponse(data []byte) ([]byte, *errors.ApiError)

func FormatResponse

func FormatResponse(data []byte, err *errors.ApiError, isBeautify bool) (dataStr string, errStr string)

func IsJson

func IsJson(b []byte) bool

func JsonMarshal

func JsonMarshal(obj interface{}) ([]byte, error)

func NewFileWriter

func NewFileWriter(filePath string) io.Writer

Types

type OutClient

type OutClient interface {
	WriteResponse(data []byte, err *errors.ApiError)
	Fail(err error)
	FailE(err *errors.ApiError)
	FailS(errString string)
	FailF(errFmt string, args ...interface{})
}

func NewDefaultOutClient

func NewDefaultOutClient() OutClient

func NewOutClient

func NewOutClient(sw io.Writer, ew io.Writer) OutClient

Jump to

Keyboard shortcuts

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