tablewriter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v any, quote bool) ([]byte, error)

Convert any value to a byte array. If quote is true, then the value is quoted if it is a string.

func NewIterator

func NewIterator(v any) (*iterator, error)

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

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 Marshaller interface {
	Marshal() ([]byte, error)
}

type TableOpt

type TableOpt func(*tableMeta) error

type TableWriter

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

func New

func New(w io.Writer) *TableWriter

New returns a new table writer object

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

func (*TableWriter) Write

func (self *TableWriter) Write(v any, opts ...TableOpt) error

Write outputs the table to a writer

Jump to

Keyboard shortcuts

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