table

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Row added in v1.0.1

type Row = []string

type Rows added in v1.0.1

type Rows = []Row

type Table

type Table interface {
	// Save saves a table to a csv file
	Save(filename string) error
	// Fields returns the fields of the table
	Fields() Row
	// FieldIndex returns the index of a field, or -1 if the field does not exist
	FieldIndex(field string) int
	// Rows returns the rows of the table
	Rows() Rows
	// Append appends rows to the table
	Append(rows ...Row)
	// Clear clears the rows of the table
	Clear()
	// Sort sorts the table by a field
	Sort(field string) error
	// SortFunc sorts the table by a function
	SortFunc(func(row1, row2 Row) int)
}

func New

func New(fields Row, rows ...Row) Table

New creates a new table

func NewFromFile added in v1.0.2

func NewFromFile(filename string) (t Table, err error)

NewFromFile creates a new table from a csv file

Jump to

Keyboard shortcuts

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