table

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

example:

1. NewTable().Header([]string{"h1", "h2"}).Data([][]string{{"d1", "d2"}, {"d3","d4"}}).Flush() >>> H1 H2 d1 d2 d3 d4

NewTable(WithVertical()).Header([]string{"h1", "h2"}).Data([][]string{{"d1", "d2"}, {"d3","d4"}}).Flush()

>>> H1 d1 d3 H2 d2 d4

  1. 指定输出 NewTable(WithWriter(os.Stderr))

// TODO: 对中文的对齐有问题(中文可以显示在最后一列来避免 = =||)

// NOTE: 没有设置 WithVertical 时,标题行 全部都是大写 设置 WithVertical 时,标题列 为首字母大写

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataHeaderLength = errors.New("len(header) != len(data[i])")
)

Functions

This section is empty.

Types

type OpOption

type OpOption func(*tableOption)

func WithVertical

func WithVertical() OpOption

func WithWriter

func WithWriter(w io.Writer) OpOption

type Table

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

func NewTable

func NewTable(ops ...OpOption) *Table

func (*Table) Data

func (t *Table) Data(data [][]string) *Table

func (*Table) Flush

func (t *Table) Flush() error

func (*Table) Header

func (t *Table) Header(header []string) *Table

Jump to

Keyboard shortcuts

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