tables

package module
v0.0.0-...-c7f177c Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: MIT Imports: 5 Imported by: 1

README

tabula-rasa

Print tables from Go

Documentation

Index

Constants

View Source
const (
	Left = 1 << iota
	Center
	Right
	Top
	Header
	Bottom
	Horizontal
	Left2
	Center2
	Right2
	Top2
	Header2
	Bottom2195
	Horizontal2
)

Variables

View Source
var (
	// DefaultPadding specifies the number of spaces around content in columns.
	DefaultPadding = 1

	// DefaultWriter specifies the output io.Writer for the Table.Print method.
	DefaultWriter io.Writer = os.Stdout

	// DefaultWidthFunc specifies the default WidthFunc for calculating column widths
	DefaultWidthFunc WidthFunc = utf8.RuneCountInString
)

Functions

func GetAlignment

func GetAlignment(align int) (label string)

Types

type Table

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

func NewTable

func NewTable(colNames ...string) (tbl *Table)

func (*Table) AddRow

func (tbl *Table) AddRow(row ...string) (err error)

func (*Table) Align

func (tbl *Table) Align(colName string, alignment int, includeHeader bool)

func (*Table) CalcWidth

func (tbl *Table) CalcWidth(column string, pad bool, verbose bool) (calcWidth int, debug debugCol)

func (*Table) CharWidth

func (tbl *Table) CharWidth(column string) int

func (*Table) ColumnCount

func (tbl *Table) ColumnCount() int

func (*Table) FillWidths

func (tbl *Table) FillWidths()

func (*Table) GetBorder

func (tbl *Table) GetBorder(border int) (bool, bool)

func (*Table) Padding

func (tbl *Table) Padding(before bool, colIndex int) int

func (*Table) Print

func (tbl *Table) Print()

func (*Table) SetBorder

func (tbl *Table) SetBorder(border int, display bool, style bool)

type WidthFunc

type WidthFunc func(string) int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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