printer

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintResource

func PrintResource(printer Printer, resource model.Printable)

PrintResource prints a single resource. It only exists to match the syntax of PrintResource.

func PrintResources

func PrintResources[T model.Printable](printer Printer, resources []T)

PrintResources allows an array of something that implements model.Printable to be printed. It's a little extra compute in exchange for simpler code.

Types

type JSONPrinter

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

JSONPrinter logs json to an io.Writer

func NewJSONPrinter

func NewJSONPrinter(writer io.Writer, logger *zap.Logger) *JSONPrinter

NewJSONPrinter returns a new *JSONPrinter

func (*JSONPrinter) PrintResource

func (jp *JSONPrinter) PrintResource(item model.Printable)

PrintResource prints a generic model that implements the printable interface

func (*JSONPrinter) PrintResources

func (jp *JSONPrinter) PrintResources(list []model.Printable)

PrintResources prints a generic model that implements the model.Printable interface

type Printer

type Printer interface {
	// PrintResource prints a generic model that implements the printable interface
	PrintResource(model.Printable)
	// PrintResources prints a list of generic models that implements the printable interface
	PrintResources([]model.Printable)
}

Printer TODO(doc)

type TablePrinter

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

TablePrinter TODO(doc)

func NewTablePrinter

func NewTablePrinter(writer io.Writer) *TablePrinter

NewTablePrinter takes an io.Writer and returns a new *TablePrinter.

func (*TablePrinter) PrintResource

func (tp *TablePrinter) PrintResource(item model.Printable)

PrintResource prints a generic model that implements the printable interface

func (*TablePrinter) PrintResources

func (tp *TablePrinter) PrintResources(list []model.Printable)

PrintResources prints a list of generic models that implements the printable interface

func (*TablePrinter) Reset

func (tp *TablePrinter) Reset()

Reset TODO(docs)

type YamlPrinter

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

YamlPrinter TODO(doc)

func NewYamlPrinter

func NewYamlPrinter(writer io.Writer, logger *zap.Logger) *YamlPrinter

NewYamlPrinter TODO(doc)

func (*YamlPrinter) PrintResource

func (yp *YamlPrinter) PrintResource(item model.Printable)

PrintResource prints a generic model that implements the printable interface

func (*YamlPrinter) PrintResources

func (yp *YamlPrinter) PrintResources(list []model.Printable)

PrintResources prints a generic model that implements the model.Printable interface

Jump to

Keyboard shortcuts

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