reader

package
v0.0.0-...-81a5a3e Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrColNotFound        = errors.New("column not found")
	ErrNotTable           = errors.New("not a table")
	ErrNilTableReader     = errors.New("nil table reader")
	ErrNilOrEmptyRow      = errors.New("nil or empty table row")
	ErrNilOrEmptyHeader   = errors.New("nil or empty table header")
	ErrOutOfBoundsRowCell = errors.New("row cell index out of bounds")
	ErrOutOfBoundsColCell = errors.New("column cell index out of bounds")
)

Functions

func GetFromStr

func GetFromStr(str, lsep, csep string) ([][]string, error)

func Split

func Split(str, sep string) []string

Types

type Reader

type Reader interface {
	Read(str ...string) ([][]string, error) // Convert converts data to table format
	//Read1(str ...string) ([][]string, error) // Convert converts data to table format
	Format(fns ...func(input ...interface{}) (interface{}, error)) error
}

type TableReader

type TableReader struct {
	Reader Reader
	// contains filtered or unexported fields
}

func New

func New(reader Reader, str ...string) (*TableReader, error)

func NewFromStr

func NewFromStr(str, lsep, csep string) (*TableReader, error)

func (*TableReader) AddRow

func (tr *TableReader) AddRow(row []string) error

func (*TableReader) GetCell

func (tr *TableReader) GetCell(row, col uint) (string, error)

func (*TableReader) GetCellsByColumn

func (tr *TableReader) GetCellsByColumn(col string) ([]string, error)

func (*TableReader) GetColIndex

func (tr *TableReader) GetColIndex(col string) (int, error)

func (*TableReader) GetTable

func (tr *TableReader) GetTable() ([][]string, error)

func (*TableReader) Length

func (tr *TableReader) Length() (rowLength, colLength int)

func (*TableReader) SetHasHeader

func (tr *TableReader) SetHasHeader(hasHeader bool) error

func (*TableReader) SetHeader

func (tr *TableReader) SetHeader(header []string) error

Jump to

Keyboard shortcuts

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