outfmt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMode

func WithMode(ctx context.Context, format Format) context.Context

Types

type Format

type Format string
const (
	Table Format = "table"
	JSON  Format = "json"
	TSV   Format = "tsv"
)

func FromContext

func FromContext(ctx context.Context) Format

type Formatter

type Formatter interface {
	Format(w io.Writer, header []string, rows [][]string, data interface{}) error
}

func NewFormatter

func NewFormatter(f Format) Formatter

type JSONFormatter

type JSONFormatter struct{}

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(w io.Writer, header []string, rows [][]string, data interface{}) error

type TSVFormatter

type TSVFormatter struct{}

func (*TSVFormatter) Format

func (f *TSVFormatter) Format(w io.Writer, header []string, rows [][]string, data interface{}) error

type TableFormatter

type TableFormatter struct{}

func (*TableFormatter) Format

func (f *TableFormatter) Format(w io.Writer, header []string, rows [][]string, data interface{}) error

Jump to

Keyboard shortcuts

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