csv

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	FieldNum: FieldNumberFunc(FieldNumFirstRecord),
	Comma:    ',',
}

Functions

func FieldNumFirstRecord

func FieldNumFirstRecord() (n int)

func FieldNumNoCheck

func FieldNumNoCheck() (n int)

Types

type Config

type Config struct {
	FieldNum         FieldNumber
	Comma            rune
	Comment          rune
	LazyQuotes       bool
	TrimLeadingSpace bool
	ReuseRecord      bool
}

func (Config) ConfigCsvReader

func (c Config) ConfigCsvReader(r *csv.Reader) (err error)

func (Config) NewReader

func (c Config) NewReader(r io.Reader) (cr *csv.Reader, err error)

func (Config) NewWriter

func (c Config) NewWriter(w io.Writer) (cw *csv.Writer, err error)

type Configurer

type Configurer interface {
	ConfigCsvReader(r *csv.Reader) (err error)
}

type Field

type Field struct {
	Description string
	Type        num.Type
}

type FieldNumNoCheckImpl

type FieldNumNoCheckImpl struct{}

type FieldNumber

type FieldNumber interface {
	GetFieldNumber() (n int)
}

type FieldNumberFunc

type FieldNumberFunc func() (n int)

func (FieldNumberFunc) GetFieldNumber

func (f FieldNumberFunc) GetFieldNumber() (n int)

type FieldPositions

type FieldPositions map[string]int

type Fields

type Fields map[string]Field

type FixedFieldNum

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

func (FixedFieldNum) GetFieldNumber

func (f FixedFieldNum) GetFieldNumber() (n int)
type Header struct {
	Fields    Fields
	Positions FieldPositions
}

type IOCreator

type IOCreator interface {
	NewReader(r io.Reader) (cr *Reader, err error)
	NewWriter(w io.Writer) (cw *Writer, err error)
}

type InStream

type InStream struct {
	Header Header
	Reader Reader
}

type Manager

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

func NewManager

func NewManager(io IOCreator, fsys fs.FS) (m Manager)

func (Manager) MarshalToFile

func (man Manager) MarshalToFile(path string, m Marshaler) (err error)

func (Manager) Read

func (m Manager) Read(r io.Reader, un Unmarshaler) (err error)

func (Manager) ReadFile

func (m Manager) ReadFile(path string, user ReaderUser) (err error)

func (Manager) UnmarshalFromFile

func (man Manager) UnmarshalFromFile(path string, un Unmarshaler) (err error)

func (*Manager) UsePool

func (m *Manager) UsePool(p pool.Bufio)

func (Manager) UseReader

func (m Manager) UseReader(r io.Reader, user ReaderUser) (err error)

func (Manager) UseWriter

func (m Manager) UseWriter(w io.Writer, user WriterUser) (err error)

func (Manager) Write

func (man Manager) Write(w io.Writer, m Marshaler) (err error)

func (Manager) WriteFile

func (m Manager) WriteFile(path string, user WriterUser) (err error)

type Marshaler

type Marshaler interface {
	MarshalCsv(w *Writer) (err error)
}

type OutStream

type OutStream struct {
	Header Header
	Writer Writer
}

type Reader

type Reader = csv.Reader

type ReaderUser

type ReaderUser func(r *csv.Reader) (err error)

type Unmarshaler

type Unmarshaler interface {
	UnmarshalCsv(r *Reader) (err error)
}

type Writer

type Writer = csv.Writer

type WriterUser

type WriterUser func(w *csv.Writer) (err error)

Jump to

Keyboard shortcuts

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