print

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC3339Millis   = "2006-01-02T15:04:05.000Z07:00"
	GODefaultFormat = "2006-01-02 15:04:05.999999999 -0700 MST"
)

Variables

This section is empty.

Functions

func BytesFormatter added in v0.4.12

func BytesFormatter(n *jnode.Node) string

func DurationMillisFormatter added in v0.4.14

func DurationMillisFormatter(n *jnode.Node) string
func Nav(n *jnode.Node, path []string) *jnode.Node

func NumberFormatter added in v0.4.14

func NumberFormatter(n *jnode.Node) string

func ParseTime added in v0.4.24

func ParseTime(s string) (time.Time, error)

func RelativeTimestampFormatter

func RelativeTimestampFormatter(n *jnode.Node) string

func TimestampFormatter

func TimestampFormatter(n *jnode.Node) string

func ToResult added in v0.4.18

func ToResult(value interface{}) (*jnode.Node, error)

ToResult converts a value to a jnode.Node

Types

type CSVPrinter

type CSVPrinter struct {
	PathSupport
	NoHeaders  bool
	Columns    []string
	Formatters Formatters
}

func (*CSVPrinter) PrintResult

func (p *CSVPrinter) PrintResult(w io.Writer, result *jnode.Node) int

type ColumnFunction added in v0.4.17

type ColumnFunction func(n *jnode.Node) interface{}

type CountPrinter added in v0.5.7

type CountPrinter struct {
	PathSupport
}

func (*CountPrinter) PrintResult added in v0.5.7

func (p *CountPrinter) PrintResult(w io.Writer, result *jnode.Node) int

type DiffPrinter added in v0.4.14

type DiffPrinter struct {
	PathSupport
	DiffColumn    string
	VersionColumn string
	LabelColumns  []string
	Context       int
	Formatters
}

func (*DiffPrinter) PrintResult added in v0.4.14

func (d *DiffPrinter) PrintResult(w io.Writer, result *jnode.Node) int

type Filter

type Filter interface {
	Matches(*jnode.Node) bool
}

func NewAndFilter added in v0.5.7

func NewAndFilter(s []string) Filter

func NewSingleFilter added in v0.5.7

func NewSingleFilter(s string) Filter

type Formatter

type Formatter func(n *jnode.Node) string

func ChopFormatter added in v0.5.23

func ChopFormatter(width int) Formatter

func TruncateFormatter added in v0.5.4

func TruncateFormatter(width int, left bool) Formatter

type Formatters

type Formatters map[string]Formatter

func (Formatters) Format

func (f Formatters) Format(columnName string, n *jnode.Node) string

type Interface

type Interface interface {
	PrintResult(w io.Writer, result *jnode.Node) int
}

type JSONPrinter

type JSONPrinter struct{}

func (*JSONPrinter) PrintResult

func (p *JSONPrinter) PrintResult(w io.Writer, n *jnode.Node) int

type NonePrinter added in v0.4.9

type NonePrinter struct{}

func (*NonePrinter) PrintResult added in v0.4.9

func (p *NonePrinter) PrintResult(w io.Writer, result *jnode.Node) int

type PathSupport added in v0.4.8

type PathSupport struct {
	Filter
	Path            []string
	SortBy          []string
	ComputedColumns map[string]ColumnFunction
	Limit           int
}

func (*PathSupport) GetRows added in v0.4.30

func (p *PathSupport) GetRows(result *jnode.Node) []*jnode.Node

type TablePrinter

type TablePrinter struct {
	PathSupport
	NoHeaders  bool
	Columns    []string
	Formatters Formatters
}

func (*TablePrinter) PrintHeader

func (p *TablePrinter) PrintHeader(w io.Writer)

func (*TablePrinter) PrintResult

func (p *TablePrinter) PrintResult(w io.Writer, result *jnode.Node) int

func (*TablePrinter) PrintRows

func (p *TablePrinter) PrintRows(w io.Writer, result *jnode.Node) int

type TemplatePrinter added in v0.4.58

type TemplatePrinter struct {
	Template string
}

func NewTemplatePrinter added in v0.5.34

func NewTemplatePrinter(template string) (*TemplatePrinter, error)

func (*TemplatePrinter) PrintResult added in v0.4.58

func (tp *TemplatePrinter) PrintResult(w io.Writer, result *jnode.Node) int

type ValuePrinter added in v0.4.8

type ValuePrinter struct {
	PathSupport
	Format string
}

func (*ValuePrinter) PrintResult added in v0.4.8

func (p *ValuePrinter) PrintResult(w io.Writer, result *jnode.Node) int

type VerticalPrinter added in v0.4.14

type VerticalPrinter struct {
	PathSupport
	Columns []string
	Formatters
}

func (*VerticalPrinter) PrintResult added in v0.4.14

func (p *VerticalPrinter) PrintResult(w io.Writer, result *jnode.Node) int

type YAMLPrinter

type YAMLPrinter struct{}

func (*YAMLPrinter) PrintResult

func (p *YAMLPrinter) PrintResult(w io.Writer, n *jnode.Node) int

Jump to

Keyboard shortcuts

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