tabular

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package tabular provides writer implementations for working with tabular output for display

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TextTableWriter

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

TextTableWriter implements TableWriter. It writes table headers and rows as ascii-art tables. The first row written must be the column names for the table to write, and all rows written are assumed to have the same width for their respective columns (including the column names themselves). Values for all columns in the schema must be set on each row.

func NewTextTableWriter

func NewTextTableWriter(wr io.WriteCloser, sch schema.Schema) (*TextTableWriter, error)

NewTextTableWriter writes rows to the given WriteCloser based on the Schema provided, with a single table header row. The schema must contain only string type columns.

func NewTextTableWriterWithNumHeaderRows

func NewTextTableWriterWithNumHeaderRows(wr io.WriteCloser, sch schema.Schema, numHeaderRows int) (*TextTableWriter, error)

NewTextTableWriterWithNumHeaderRows writes rows to the given WriteCloser based on the Schema provided, with the first numHeaderRows rows in the table header. The schema must contain only string type columns.

func (*TextTableWriter) Close

func (ttw *TextTableWriter) Close(ctx context.Context) error

Close should flush all writes, release resources being held

func (*TextTableWriter) GetSchema

func (ttw *TextTableWriter) GetSchema() schema.Schema

GetSchema gets the schema of the rows that this writer writes

func (*TextTableWriter) WriteRow

func (ttw *TextTableWriter) WriteRow(ctx context.Context, r row.Row) error

WriteRow will write a row to a table

Jump to

Keyboard shortcuts

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