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) 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) }