marshal

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshall

func Marshall(format FormatType, items ...interface{}) ([]byte, error)

Marshall marshals list of items.

Types

type FormatType

type FormatType int

FormatType describes output format type.

const (
	Plain FormatType = iota
	JSON
	NDJSON
	Trace
)

type Marshal

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

Marshal implements the Marshaller interface. It wraps other marshaller based on argument passed to the NewMarshal method.

func NewMarshal

func NewMarshal(format FormatType) (*Marshal, error)

NewMarshal returns new Marshal instance.

func (*Marshal) Flush

func (m *Marshal) Flush() error

Flush implements the Marshaller interface.

func (*Marshal) Write

func (m *Marshal) Write(writer io.Writer, item interface{}) error

Write implements the Marshaller interface.

type Marshaller

type Marshaller interface {
	Write(writer io.Writer, item interface{}) error
	Flush() error
}

Marshaller is the interface which must be implemented by different marshallers used to format output for the CLI.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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