table

package
v1.35.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTableStyle = TableStyle{
	Padding:           1,
	VerticalBorders:   true,
	HorizontalBorders: true,
	MaxTableWidth:     120,
	MaxColWidth:       40,
	EnableTextStyling: true,
}

Functions

This section is empty.

Types

type AlignType

type AlignType uint
const (
	AlignTypeLeft AlignType = iota
	AlignTypeCenter
	AlignTypeRight
)

type Cell

type Cell struct {
	Contents []string
	Style    string
	Align    AlignType
}

func C

func C(contents string, args ...interface{}) Cell

func (Cell) Width

func (c Cell) Width() (int, int)

type Divider

type Divider string

type Row

type Row struct {
	Cells   []Cell
	Divider string
	Style   string
}

func R

func R(args ...interface{}) *Row

func (*Row) AppendCell

func (r *Row) AppendCell(cells ...Cell) *Row

func (*Row) Render

func (r *Row) Render(widths []int, totalWidth int, tableStyle TableStyle, isLastRow bool) string

type Table

type Table struct {
	Rows []*Row

	TableStyle TableStyle
}

func NewTable

func NewTable() *Table

func (*Table) AppendRow

func (t *Table) AppendRow(row *Row) *Table

func (*Table) Render

func (t *Table) Render() string

type TableStyle

type TableStyle struct {
	Padding           int
	VerticalBorders   bool
	HorizontalBorders bool
	MaxTableWidth     int
	MaxColWidth       int
	EnableTextStyling bool
}

Jump to

Keyboard shortcuts

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