table

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

gocui table

Documentation

Index

Constants

View Source
const (
	// AlignLeft int
	AlignLeft = Align(iota)
	// AlignRight int
	AlignRight
	// AlignCenter int
	AlignCenter
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Align

type Align int

Align int

type Col

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

Col struct

func (*Col) AlignCenter

func (c *Col) AlignCenter() *Col

AlignCenter align center

func (*Col) AlignLeft

func (c *Col) AlignLeft() *Col

AlignLeft align left

func (*Col) AlignRight

func (c *Col) AlignRight() *Col

AlignRight align right

func (*Col) Hide

func (c *Col) Hide() *Col

Hide hide

func (*Col) SetFormat

func (c *Col) SetFormat(f string) *Col

SetFormat sets format

func (*Col) SetFormatFn

func (c *Col) SetFormatFn(f FormatFn) *Col

SetFormatFn set format function

func (*Col) SetWidth

func (c *Col) SetWidth(w int) *Col

SetWidth set width

func (*Col) SetWidthPerc

func (c *Col) SetWidthPerc(w int) *Col

SetWidthPerc set width percentage

type Cols

type Cols []*Col

Cols columns

func (Cols) Index

func (c Cols) Index(n string) int

Index index

type FormatFn

type FormatFn func(interface{}) string

FormatFn format function

type Row

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

Row row

type RowCell

type RowCell struct {
	LeftMargin  int
	RightMargin int
	Width       int
	LeftAlign   bool
	Color       func(a ...interface{}) string
	Text        string
}

RowCell is a row cell struct

func (*RowCell) String

func (rc *RowCell) String() string

String returns row cell as string

type Rows

type Rows []*Row

Rows rows

func (Rows) Len

func (r Rows) Len() int

Len count

func (Rows) Less

func (r Rows) Less(i, j int) bool

Less less

func (Rows) Swap

func (r Rows) Swap(i, j int)

Swap swap rows

type SortBy

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

SortBy sort by

type SortFn

type SortFn func(interface{}, interface{}) bool

SortFn sort function

type SortOrder

type SortOrder int

SortOrder int

const (
	// SortNone sort none
	SortNone SortOrder = iota
	// SortAsc sort ascendinge
	SortAsc
	// SortDesc sort descending
	SortDesc
)

type Table

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

Table table

func NewTable

func NewTable() *Table

NewTable new table

func (*Table) AddCol

func (t *Table) AddCol(n string) *Col

AddCol add column

func (*Table) AddRow

func (t *Table) AddRow(v ...interface{}) *Row

AddRow add row

func (*Table) AddRowCells

func (t *Table) AddRowCells(cells ...*RowCell) *Row

AddRowCells add row using cells

func (*Table) Format

func (t *Table) Format() *Table

Format format table

func (*Table) Fprint

func (t *Table) Fprint(w io.Writer)

Fprint write

func (*Table) RowCount

func (t *Table) RowCount() int

RowCount returns the number of rows

func (*Table) SetNumCol

func (t *Table) SetNumCol(count int)

SetNumCol sets the number of columns

func (*Table) SetWidth

func (t *Table) SetWidth(w int) *Table

SetWidth set table width

func (*Table) Sort

func (t *Table) Sort() *Table

Sort sort

func (*Table) SortAsc

func (t *Table) SortAsc(n string) *Table

SortAsc sort ascending

func (*Table) SortAscFn

func (t *Table) SortAscFn(n string, fn SortFn) *Table

SortAscFn sort ascending function

func (*Table) SortDesc

func (t *Table) SortDesc(n string) *Table

SortDesc sort descending

func (*Table) SortDescFn

func (t *Table) SortDescFn(n string, fn SortFn) *Table

SortDescFn sort descending function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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