csv

package
v0.0.0-...-bd113ff Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvReader

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

CsvReader implements dio.Reader for CSV files.

func NewReader

func NewReader(path string, opts ...ReaderOption) (*CsvReader, error)

NewReader creates a CSV Reader from a file path. The schema is eagerly inferred by opening the file and reading the first record.

func (*CsvReader) Read

func (r *CsvReader) Read(ctx context.Context, opts ...dio.ReadOption) (dio.BatchStream, error)

Read opens a stream of Arrow RecordBatches from the CSV file. Each call re-opens the file, supporting multiple reads.

func (*CsvReader) Schema

func (r *CsvReader) Schema() *arrow.Schema

Schema returns the Arrow schema for this CSV source.

type CsvWriter

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

CsvWriter implements dio.Writer for CSV files.

func NewWriter

func NewWriter(w io.Writer, opts ...WriterOption) *CsvWriter

NewWriterFromWriter creates a CSV Writer that writes to any io.Writer.

func (*CsvWriter) Close

func (w *CsvWriter) Close() error

Close finalizes the CSV writer. Only closes the underlying file if the writer was created via NewWriter (path-based constructor).

func (*CsvWriter) WriteStream

func (w *CsvWriter) WriteStream(ctx context.Context, s dio.BatchStream) error

WriteStream writes all records from the stream to the CSV file.

type ReaderOption

type ReaderOption func(*readerConfig)

ReaderOption configures a CsvReader.

func WithBatchSize

func WithBatchSize(size int) ReaderOption

WithBatchSize sets the number of rows per batch.

func WithDelimiter

func WithDelimiter(delim rune) ReaderOption

WithDelimiter sets the field separator character.

func WithHeader

func WithHeader(header bool) ReaderOption

WithHeader sets whether the first row contains column names.

func WithNullValues

func WithNullValues(values []string) ReaderOption

WithNullValues sets the strings that should be interpreted as NULL.

func WithSchema

func WithSchema(schema *arrow.Schema) ReaderOption

WithSchema sets an explicit schema. If nil, schema is inferred.

type WriterOption

type WriterOption func(*writerConfig)

WriterOption configures a CsvWriter.

func WithWriterDelimiter

func WithWriterDelimiter(delim rune) WriterOption

WithWriterDelimiter sets the field separator character for writing.

func WithWriterHeader

func WithWriterHeader(header bool) WriterOption

WithWriterHeader sets whether to write a header row.

Jump to

Keyboard shortcuts

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