formatters

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package formatters contains implementations of table handles that can format data into tables, json, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONFormatter

type JSONFormatter struct {
	// contains filtered or unexported fields
}

JSONFormatter formats data as JSON.

func NewJSONFormatter

func NewJSONFormatter(w io.Writer, opts ...JSONFormatterOption) (*JSONFormatter, error)

NewJSONFormatter creates a JSONFormatter

func (*JSONFormatter) HandleDone

func (j *JSONFormatter) HandleDone(ctx context.Context) error

HandleDone is called when all data has been streamed.

func (*JSONFormatter) HandleInit

func (j *JSONFormatter) HandleInit(ctx context.Context, metadata types.TableMetadata) error

HandleInit is called when the table metadata is available.

func (*JSONFormatter) HandleRecord

func (j *JSONFormatter) HandleRecord(ctx context.Context, record *types.Record) error

HandleRecord is called for each record of the table.

type JSONFormatterOption

type JSONFormatterOption func(*JSONFormatter)

JSONFormatterOption configures options on the formatter.

type TableFormatter

type TableFormatter struct {
	// contains filtered or unexported fields
}

TableFormatter formats data as table.

func NewTableFormatter

func NewTableFormatter(w io.Writer, opts ...TableFormatterOption) (*TableFormatter, error)

NewTableFormatter creates a TableFormatter with the specified options.

func (*TableFormatter) HandleDone

func (t *TableFormatter) HandleDone(ctx context.Context) error

HandleDone is called when all data has been streamed.

func (*TableFormatter) HandleInit

func (t *TableFormatter) HandleInit(ctx context.Context, metadata types.TableMetadata) error

HandleInit is called when the table metadata is available.

func (*TableFormatter) HandleRecord

func (t *TableFormatter) HandleRecord(ctx context.Context, record *types.Record) error

HandleRecord is called for each record of the table.

type TableFormatterOption

type TableFormatterOption func(t *TableFormatter)

TableFormatterOption configures options on the formatter.

Jump to

Keyboard shortcuts

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