sdcsv

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sdcsv CSV扩展

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerResult

type HandlerResult int
const (
	Stop     HandlerResult = 0
	Continue HandlerResult = 1
)

type Options

type Options struct {
	Header           bool
	Fields           []string
	Comma            rune
	Comment          rune
	FieldsPerRecord  int
	LazyQuotes       bool
	TrimLeadingSpace bool
	ReuseRecord      bool
}

type Reader

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

func NewReader

func NewReader(r io.Reader, opts *Options) (*Reader, error)

func NewReaderBytes

func NewReaderBytes(b []byte, opts *Options) (*Reader, error)

func NewReaderFile

func NewReaderFile(filename string, opts *Options) (*Reader, error)

func NewReaderText

func NewReaderText(s string, opts *Options) (*Reader, error)

func (*Reader) Fields

func (r *Reader) Fields() []string

func (*Reader) ForeachMap

func (r *Reader) ForeachMap(h func(recNo int, rec map[string]string) HandlerResult) error

func (*Reader) ForeachRecord

func (r *Reader) ForeachRecord(h func(recNo int, rec []string) HandlerResult) error

func (*Reader) ReadMap

func (r *Reader) ReadMap() (map[string]string, error)

func (*Reader) ReadMaps

func (r *Reader) ReadMaps() ([]map[string]string, error)

func (*Reader) ReadRecord

func (r *Reader) ReadRecord() ([]string, error)

func (*Reader) ReadRecords

func (r *Reader) ReadRecords() ([][]string, error)

Jump to

Keyboard shortcuts

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