formatter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(resp *http.Response, opts Options) ([]byte, error)

Format generate formatted result for response.

Types

type Formatter

type Formatter interface {
	Format(*http.Response) ([]byte, error)
}

Formatter generate formatted result for response.

type JsonFormatter

type JsonFormatter struct{}

JsonFormatter use to convert response to json format.

func (*JsonFormatter) Format

func (f *JsonFormatter) Format(resp *http.Response) ([]byte, error)

type Options added in v0.5.0

type Options struct {
	Format    string
	Columns   []string
	Group     string
	Operation string
}

type TableFormatter

type TableFormatter struct {
	Columns           []string
	Group             string
	Operation         string
	ColumnDisplayName func(string) string
}

TableFormatter use to convert response to table format.

func DefaultTableFormatter added in v0.6.0

func DefaultTableFormatter(columns []string, group, operation string) *TableFormatter

func (*TableFormatter) Format

func (f *TableFormatter) Format(resp *http.Response) ([]byte, error)

func (*TableFormatter) ResourceItems added in v0.6.0

func (f *TableFormatter) ResourceItems(body []byte) string

type YamlFormatter

type YamlFormatter struct{}

YamlFormatter use to convert response to yaml format.

func (*YamlFormatter) Format

func (f *YamlFormatter) Format(resp *http.Response) ([]byte, error)

Jump to

Keyboard shortcuts

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