formatter

package
v0.0.0-...-4b33866 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputText  = Output("text")
	OutputTable = Output("table")
	OutputJSON  = Output("json")
	OutputYAML  = Output("yaml")
)

Variables

This section is empty.

Functions

func Format

func Format(data interface{}, opts *Opts) (io.Reader, error)

Types

type Config

type Config struct {
	Name  string       `json:"name"`
	Type  reflect.Type `json:"type"`
	Value string       `json:"value"`
}

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

type ConfigList

type ConfigList []Config

func ToConfigList

func ToConfigList(c *config.Config) ConfigList

func (ConfigList) FormatJSON

func (f ConfigList) FormatJSON(opts *Opts) (io.Reader, error)

func (ConfigList) FormatTable

func (f ConfigList) FormatTable(_ *Opts) (io.Reader, error)

func (ConfigList) FormatYAML

func (f ConfigList) FormatYAML(opts *Opts) (io.Reader, error)

type Foo

type Foo struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Age  string `json:"age"`
}

type FooItem

type FooItem Foo

func (FooItem) FormatJSON

func (d FooItem) FormatJSON(opts *Opts) (io.Reader, error)

func (FooItem) FormatText

func (f FooItem) FormatText(opts *Opts) (io.Reader, error)

func (FooItem) FormatYAML

func (d FooItem) FormatYAML(opts *Opts) (io.Reader, error)

type FooList

type FooList []Foo

func (FooList) FormatJSON

func (f FooList) FormatJSON(opts *Opts) (io.Reader, error)

func (FooList) FormatTable

func (f FooList) FormatTable(_ *Opts) (io.Reader, error)

func (FooList) FormatYAML

func (f FooList) FormatYAML(opts *Opts) (io.Reader, error)

type JSONFormatter

type JSONFormatter interface {
	FormatJSON(opts *Opts) (io.Reader, error)
}

type Opts

type Opts struct {
	Output Output
	Query  string
}

type Output

type Output string

type TableFormatter

type TableFormatter interface {
	FormatTable(opts *Opts) (io.Reader, error)
}

type TextFormatter

type TextFormatter interface {
	FormatText(opts *Opts) (io.Reader, error)
}

type YAMLFormatter

type YAMLFormatter interface {
	FormatYAML(opts *Opts) (io.Reader, error)
}

Jump to

Keyboard shortcuts

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