Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Convert any value to a byte array. If quote is true, then the value is quoted if it is a string.
func NewIterator ¶
NewTableMeta returns a new table metadata object, from a single struct value or an array of one or more struct values which are of the same type
func NewTableRow ¶
func NewTableRow(Meta []ColumnMeta) *tableRow
Types ¶
type ColumnMeta ¶
type ColumnMeta struct { Key string // the unique key of the field Name string // the name of the field Index []int // the index of the field Tuples []string // the tuples from the tag NonZero bool // true if there is a non-zero value in this column Width int // the maximum we column }
func (ColumnMeta) IsAlignRight ¶
func (m ColumnMeta) IsAlignRight() bool
type Marshaller ¶
type TableMeta ¶
type TableMeta struct { Type reflect.Type // The underlying type Columns []ColumnMeta // The columns for the table Iterator *iterator // The iterator for the rows // contains filtered or unexported fields }
type TableOpt ¶
func OptTextWidth ¶
Output text table format, with a delimiter, optional header and width
type TableWriter ¶
type TableWriter struct {
// contains filtered or unexported fields
}
func (*TableWriter) NewMeta ¶
func (t *TableWriter) NewMeta(v any, opts ...TableOpt) (*TableMeta, error)
returns a new metadata object, from a single struct value or an array of one or more struct values which are of the same type
func (*TableWriter) String ¶
func (t *TableWriter) String() string
type TextWriter ¶
type TextWriter struct {
// contains filtered or unexported fields
}
func NewTextWriter ¶
func NewTextWriter(columns []ColumnMeta) *TextWriter
Write outputs the table to a writer
func (*TextWriter) Formatln ¶
func (self *TextWriter) Formatln(delim rune) string
Create a format string for the writer
func (*TextWriter) Sizeln ¶
func (self *TextWriter) Sizeln(elems []string)
Determine the maximum width of each column
Source Files ¶
Click to show internal directories.
Click to hide internal directories.