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 ¶
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 ¶
HandleRecord is called for each record of the table.
type TableFormatterOption ¶
type TableFormatterOption func(t *TableFormatter)
TableFormatterOption configures options on the formatter.