Documentation ¶
Overview ¶
Package printer provides an interface for printing resources, and several implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintResource ¶
PrintResource prints a single resource. It only exists to match the syntax of PrintResource.
func PrintResources ¶
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 CSVPrinter ¶ added in v1.25.0
type CSVPrinter struct {
// contains filtered or unexported fields
}
CSVPrinter logs CSV to an io.Writer
func NewCSVPrinter ¶ added in v1.25.0
func NewCSVPrinter(writer io.Writer, logger *zap.Logger) *CSVPrinter
NewCSVPrinter returns a new *CSVPrinter
func (*CSVPrinter) PrintResource ¶ added in v1.25.0
func (cp *CSVPrinter) PrintResource(item model.Printable)
PrintResource prints a generic model that implements the printable interface
func (*CSVPrinter) PrintResources ¶ added in v1.25.0
func (cp *CSVPrinter) PrintResources(list []model.Printable)
PrintResources prints a generic model that implements the model.Printable interface
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 formats and prints printable resources
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
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