xtable

package
v0.0.0-...-89edfd8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlignType

type AlignType int

AlignType is type of alignment to use for when logging

const (
	// AlignCenter will align given text to center of space available
	AlignCenter AlignType = iota
	// AlignLeft will align given text to left
	AlignLeft
	// AlignRight will align given text to right
	AlignRight
)

type TableWriter

type TableWriter struct {
	ColumnHeaders []string
	ColumnWidths  []int
	// contains filtered or unexported fields
}

TableWriter will write the given row data in form of a pretty table

func NewTableWriter

func NewTableWriter(columnHeaders []string, columnWidths []int) (*TableWriter, error)

NewTableWriter will initialize the table writer to format data

func NewTableWriterWithWriter

func NewTableWriterWithWriter(writer io.Writer, columnHeaders []string, columnWidths []int) (*TableWriter, error)

NewTableWriterWithWriter will initialize the table writer with given writer to format data

func (*TableWriter) PrintFooter

func (t *TableWriter) PrintFooter()

PrintFooter will print footer to close the table

func (*TableWriter) PrintHeader

func (t *TableWriter) PrintHeader()

PrintHeader will print the header of the table with column headers

func (*TableWriter) PrintRow

func (t *TableWriter) PrintRow(row []string, alignmentType AlignType) error

PrintRow will print data given in form a row in a table

func (*TableWriter) PrintRowAsOneColumn

func (t *TableWriter) PrintRowAsOneColumn(value string, alignmentType AlignType) error

PrintRowAsOneColumn prints given value as single column

func (*TableWriter) PrintRows

func (t *TableWriter) PrintRows(rows [][]string, alignmentType AlignType) error

PrintRows will print given rows only

func (*TableWriter) PrintTable

func (t *TableWriter) PrintTable(rows [][]string, alignmentType AlignType)

PrintTable will print given rows data as table at once

Jump to

Keyboard shortcuts

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