formatter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFormatterNotFound Error occurred when the formatter is not found
	ErrFormatterNotFound = errors.New("formatter not found")
)

Functions

func ListFormatterAvailable

func ListFormatterAvailable() []string

ListFormatterAvailable formatter available

func Register

func Register(name string, loadFn func() Formatter)

Register Register a formatter

Types

type Formatter

type Formatter interface {
	Format(in interface{}) ([]byte, error)
}

Formatter ...

func New

func New(name string) (Formatter, error)

New ...

func NewJSONFormatter

func NewJSONFormatter() Formatter

NewJSONFormatter ...

func NewYAMLFormatter

func NewYAMLFormatter() Formatter

NewYAMLFormatter ...

type JSONFormatter

type JSONFormatter struct{}

JSONFormatter ...

func (JSONFormatter) Format

func (y JSONFormatter) Format(in interface{}) ([]byte, error)

Format marshalling input data as JSON

type YAMLFormatter

type YAMLFormatter struct{}

YAMLFormatter ...

func (YAMLFormatter) Format

func (y YAMLFormatter) Format(in interface{}) ([]byte, error)

Format marshalling input data as YAML

Jump to

Keyboard shortcuts

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