csv

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareNumber added in v1.10.0

func CompareNumber(item1 string, item2 string) (int, error)

func CompareString added in v1.10.0

func CompareString(item1 string, item2 string) (int, error)

func Descending added in v1.10.0

func Descending(compare func(item1 string, item2 string) (int, error)) func(item1 string, item2 string) (int, error)

func Encoding added in v1.4.0

func Encoding(name string) (encoding.Encoding, error)

Types

type CsvReader

type CsvReader interface {
	Read() (record []string, err error)
}

func NewCsvReader

func NewCsvReader(r io.Reader, f Format) CsvReader

type CsvSortedRows added in v1.10.0

type CsvSortedRows interface {
	Count() int
	ColumnNames() []string
	Row(index int) ([]string, error)
	Close() error
}

func LoadCsvFileSortedRows added in v1.10.0

func LoadCsvFileSortedRows(reader CsvReader, useColumnNames []string, compare func(item1 string, item2 string) (int, error)) (CsvSortedRows, error)

func LoadCsvMemorySortedRows added in v1.10.0

func LoadCsvMemorySortedRows(reader CsvReader, useColumnNames []string, compare func(item1 string, item2 string) (int, error)) (CsvSortedRows, error)

type CsvTable

type CsvTable interface {
	Find(key string) (map[string]string, error)
	KeyColumnName() string
	ColumnNames() []string
	Close() error
}

func LoadCsvFileTable

func LoadCsvFileTable(reader CsvReader, keyColumnName string) (CsvTable, error)

func LoadCsvMemoryTable

func LoadCsvMemoryTable(reader CsvReader, keyColumnName string) (CsvTable, error)

type CsvWriter

type CsvWriter interface {
	Write(record []string) error
	Flush() error
}

func NewCsvWriter

func NewCsvWriter(w io.Writer, f Format) CsvWriter

type Format added in v1.3.0

type Format struct {
	Delimiter       rune
	Quote           rune
	RecordSeparator string
	AllQuotes       bool
	WithBom         bool
	Encoding        encoding.Encoding
}

type ItemSet added in v1.7.0

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

func LoadItemSet added in v1.7.0

func LoadItemSet(reader CsvReader, targetColumnName string) (*ItemSet, error)

func NewItemSet added in v1.7.0

func NewItemSet() *ItemSet

func (*ItemSet) Add added in v1.7.0

func (hashset *ItemSet) Add(item string)

func (*ItemSet) Contains added in v1.7.0

func (hashset *ItemSet) Contains(item string) bool

func (*ItemSet) Count added in v1.7.0

func (hashset *ItemSet) Count() int

type SortSource added in v1.10.0

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

Jump to

Keyboard shortcuts

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