table

package
v0.0.108 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnSort

type ColumnSort struct {
	Column int
	Asc    bool
}

type Section

type Section struct {
	FirstColumn Value
	Rows        [][]Value
}

type Sorting

type Sorting struct {
	SortBy []ColumnSort
	Rows   [][]Value
}

func (Sorting) Len

func (s Sorting) Len() int

func (Sorting) Less

func (s Sorting) Less(i, j int) bool

func (Sorting) Swap

func (s Sorting) Swap(i, j int)

type Table

type Table struct {
	Title   string
	Content string

	// Either strings or values should be provided
	Header     []string
	HeaderVals []Value

	SortBy []ColumnSort

	// Either sections or rows should be provided
	Sections []Section
	Rows     [][]Value

	Notes []string

	// Formatting
	FillFirstColumn bool
	BackgroundStr   string
	BorderStr       string
}

func (Table) AsRows

func (t Table) AsRows() [][]Value

func (Table) Print

func (t Table) Print(w io.Writer) error

type Value

type Value interface {
	Value() Value
	String() string
	Compare(Value) int
}

type ValueBool

type ValueBool struct {
	B bool
}

func NewValueBool

func NewValueBool(b bool) ValueBool

func (ValueBool) Compare

func (t ValueBool) Compare(other Value) int

func (ValueBool) String

func (t ValueBool) String() string

func (ValueBool) Value

func (t ValueBool) Value() Value

type ValueBytes

type ValueBytes struct {
	I uint64
}

func NewValueBytes

func NewValueBytes(i uint64) ValueBytes

func NewValueMegaBytes added in v0.0.53

func NewValueMegaBytes(i uint64) ValueBytes

func (ValueBytes) Compare

func (t ValueBytes) Compare(other Value) int

func (ValueBytes) String

func (t ValueBytes) String() string

func (ValueBytes) Value

func (t ValueBytes) Value() Value

type ValueError

type ValueError struct {
	E error
}

func NewValueError

func NewValueError(e error) ValueError

func (ValueError) Compare

func (t ValueError) Compare(other Value) int

func (ValueError) String

func (t ValueError) String() string

func (ValueError) Value

func (t ValueError) Value() Value

type ValueFmt

type ValueFmt struct {
	V     Value
	Error bool
	Func  func(string, ...interface{}) string
}

func NewValueFmt

func NewValueFmt(v Value, error bool) ValueFmt

func (ValueFmt) Compare

func (t ValueFmt) Compare(other Value) int

func (ValueFmt) Fprintf

func (t ValueFmt) Fprintf(w io.Writer, pattern string, rest ...interface{}) (int, error)

func (ValueFmt) String

func (t ValueFmt) String() string

func (ValueFmt) Value

func (t ValueFmt) Value() Value

type ValueInt

type ValueInt struct {
	I int
}

func NewValueInt

func NewValueInt(i int) ValueInt

func (ValueInt) Compare

func (t ValueInt) Compare(other Value) int

func (ValueInt) String

func (t ValueInt) String() string

func (ValueInt) Value

func (t ValueInt) Value() Value

type ValueInterface

type ValueInterface struct {
	I interface{}
}

func NewValueInterface

func NewValueInterface(i interface{}) ValueInterface

func (ValueInterface) Compare

func (t ValueInterface) Compare(other Value) int

func (ValueInterface) String

func (t ValueInterface) String() string

func (ValueInterface) Value

func (t ValueInterface) Value() Value

type ValueNone

type ValueNone struct{}

func (ValueNone) Compare

func (t ValueNone) Compare(other Value) int

func (ValueNone) String

func (t ValueNone) String() string

func (ValueNone) Value

func (t ValueNone) Value() Value

type ValueString

type ValueString struct {
	S string
}

func NewValueString

func NewValueString(s string) ValueString

func (ValueString) Compare

func (t ValueString) Compare(other Value) int

func (ValueString) String

func (t ValueString) String() string

func (ValueString) Value

func (t ValueString) Value() Value

type ValueStrings

type ValueStrings struct {
	S []string
}

func NewValueStrings

func NewValueStrings(s []string) ValueStrings

func (ValueStrings) Compare

func (t ValueStrings) Compare(other Value) int

func (ValueStrings) String

func (t ValueStrings) String() string

func (ValueStrings) Value

func (t ValueStrings) Value() Value

type ValueSuffix

type ValueSuffix struct {
	V      Value
	Suffix string
}

func NewValueSuffix

func NewValueSuffix(v Value, s string) ValueSuffix

func (ValueSuffix) Compare

func (t ValueSuffix) Compare(other Value) int

func (ValueSuffix) String

func (t ValueSuffix) String() string

func (ValueSuffix) Value

func (t ValueSuffix) Value() Value

type ValueTime

type ValueTime struct {
	T time.Time
}

func NewValueTime

func NewValueTime(t time.Time) ValueTime

func (ValueTime) Compare

func (t ValueTime) Compare(other Value) int

func (ValueTime) String

func (t ValueTime) String() string

func (ValueTime) Value

func (t ValueTime) Value() Value

type ValueVersion

type ValueVersion struct {
	V semver.Version
}

func NewValueVersion

func NewValueVersion(v semver.Version) ValueVersion

func (ValueVersion) Compare

func (t ValueVersion) Compare(other Value) int

func (ValueVersion) String

func (t ValueVersion) String() string

func (ValueVersion) Value

func (t ValueVersion) Value() Value

type Writer

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

func NewWriter

func NewWriter(w io.Writer, emptyStr, bgStr, borderStr string) *Writer

func (*Writer) Flush

func (w *Writer) Flush() error

func (*Writer) Write

func (w *Writer) Write(vals []Value)

Jump to

Keyboard shortcuts

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