dbcsv

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = FileType("")
	Csv     = FileType("csv")
	Xls     = FileType("xls")
	XlsX    = FileType("xlsx")
)
View Source
const (
	DateFormat     = "20060102"
	DateTimeFormat = "20060102150405"
)

Variables

View Source
var DefaultEncoding = encoding.Replacement
View Source
var UnknownSheet = errors.New("unknown sheet")

Functions

func ReadCSV

func ReadCSV(ctx context.Context, fn func(Row) error, r io.Reader, delim string, columns []int, skip int) error

func ReadXLSFile

func ReadXLSFile(ctx context.Context, fn func(string, Row) error, filename string, charset string, sheetIndex int, columns []int, skip int) error

func ReadXLSXFile

func ReadXLSXFile(ctx context.Context, fn func(string, Row) error, filename string, sheetIndex int, columns []int, skip int) error

Types

type Config

type Config struct {
	Sheet, Skip   int
	Delim         string
	Charset       string
	ColumnsString string
	// contains filtered or unexported fields
}

func (*Config) Close

func (cfg *Config) Close() error

func (*Config) Columns

func (cfg *Config) Columns() ([]int, error)

func (*Config) Encoding

func (cfg *Config) Encoding() (encoding.Encoding, error)

func (*Config) Open

func (cfg *Config) Open(fileName string) error

func (*Config) OpenVolatile

func (cfg *Config) OpenVolatile(fileName string) error

func (*Config) ReadRows

func (cfg *Config) ReadRows(ctx context.Context, fn func(string, Row) error) (err error)

func (*Config) Type

func (cfg *Config) Type() (FileType, error)

type FileType

type FileType string

func DetectReaderType

func DetectReaderType(r io.Reader, fileName string) (FileType, error)

type Row

type Row struct {
	Line   int
	Values []string
}

Directories

Path Synopsis
Package main in csvdump represents a cursor->csv dumper
Package main in csvdump represents a cursor->csv dumper
Package main in tablecopy is a table copier between databases.
Package main in tablecopy is a table copier between databases.

Jump to

Keyboard shortcuts

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