tablewriter

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASCIIWriter

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

ASCIIWriter write table as ASCII format

func (*ASCIIWriter) AppendRow

func (t *ASCIIWriter) AppendRow(row []interface{}) error

AppendRow append row data

func (*ASCIIWriter) Flush

func (t *ASCIIWriter) Flush() error

Flush the buffer

func (*ASCIIWriter) FlushWithError

func (t *ASCIIWriter) FlushWithError(e error) error

FlushWithError flushes the buffer and end with the error message

func (*ASCIIWriter) SetHeader

func (t *ASCIIWriter) SetHeader(head map[string]interface{}) error

SetHeader set the table header

type ProtobufWriter

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

ProtobufWriter write table as protobuf text format

func (*ProtobufWriter) AppendRow

func (table *ProtobufWriter) AppendRow(row []interface{}) error

AppendRow appends row into buffer

func (*ProtobufWriter) Flush

func (table *ProtobufWriter) Flush() error

Flush the buffer to writer

func (*ProtobufWriter) FlushWithError

func (table *ProtobufWriter) FlushWithError(err error) error

FlushWithError flushes the buffer and end with the error message

func (*ProtobufWriter) SetHeader

func (table *ProtobufWriter) SetHeader(head map[string]interface{}) error

SetHeader set the table header

type TableWriter

type TableWriter interface {
	SetHeader(map[string]interface{}) error
	AppendRow([]interface{}) error
	Flush() error
	FlushWithError(error) error
}

TableWriter write the Table a special format, the example code of ASCII formatter:

table := NewTableWriter("ascii", 1024, os.Stdout) defer table.Flush() table.SetHeader("col1", "col2") table.AppendRow([]string{"1.0", "1.1"}) table.AppendRow([]string{"2.0", "2.1"})

if e := table.Flush(); e != nil {
  log.Falt(e)
}

func Create

func Create(name string, bufSize int, w io.Writer) (TableWriter, error)

Create returns a TableWriter instance

Jump to

Keyboard shortcuts

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