Documentation
¶
Index ¶
- func NewExporter(adapter tabular.RowAdapter, opts ...ExportOption) tabular.Exporter
- func NewExporterFor[T any](opts ...ExportOption) tabular.Exporter
- func NewImporter(adapter tabular.RowAdapter, opts ...ImportOption) tabular.Importer
- func NewImporterFor[T any](opts ...ImportOption) tabular.Importer
- func NewMapExporter(specs []tabular.ColumnSpec, opts ...ExportOption) (tabular.Exporter, error)
- func NewMapImporter(specs []tabular.ColumnSpec, mapOpts []tabular.MapOption, opts ...ImportOption) (tabular.Importer, error)
- func NewTypedExporterFor[T any](opts ...ExportOption) tabular.TypedExporter[T]
- func NewTypedImporterFor[T any](opts ...ImportOption) tabular.TypedImporter[T]
- type ExportOption
- type ImportOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExporter ¶
func NewExporter(adapter tabular.RowAdapter, opts ...ExportOption) tabular.Exporter
NewExporter creates a CSV exporter driven by the provided RowAdapter.
func NewExporterFor ¶
func NewExporterFor[T any](opts ...ExportOption) tabular.Exporter
NewExporterFor creates a CSV exporter bound to struct type T.
func NewImporter ¶
func NewImporter(adapter tabular.RowAdapter, opts ...ImportOption) tabular.Importer
NewImporter creates a CSV importer driven by the provided RowAdapter.
func NewImporterFor ¶
func NewImporterFor[T any](opts ...ImportOption) tabular.Importer
NewImporterFor creates a CSV importer bound to struct type T.
func NewMapExporter ¶ added in v0.22.0
func NewMapExporter( specs []tabular.ColumnSpec, opts ...ExportOption, ) (tabular.Exporter, error)
NewMapExporter creates a CSV exporter that writes []map[string]any rows using the provided dynamic column specs.
func NewMapImporter ¶ added in v0.22.0
func NewMapImporter( specs []tabular.ColumnSpec, mapOpts []tabular.MapOption, opts ...ImportOption, ) (tabular.Importer, error)
NewMapImporter creates a CSV importer that parses rows into []map[string]any using the provided dynamic column specs. Pass nil for mapOpts when no MapAdapter options (e.g. row validators) are needed.
func NewTypedExporterFor ¶ added in v0.22.0
func NewTypedExporterFor[T any](opts ...ExportOption) tabular.TypedExporter[T]
NewTypedExporterFor creates a CSV exporter bound to struct type T that accepts []T directly, eliminating the need for an any-typed argument.
func NewTypedImporterFor ¶ added in v0.22.0
func NewTypedImporterFor[T any](opts ...ImportOption) tabular.TypedImporter[T]
NewTypedImporterFor creates a CSV importer bound to struct type T that returns []T directly, eliminating the need for a type assertion.
Types ¶
type ExportOption ¶
type ExportOption func(*exportConfig)
ExportOption configures the CSV exporter behavior.
func WithCRLF ¶ added in v0.22.0
func WithCRLF() ExportOption
WithCRLF enables Windows-style line endings for compatibility with legacy systems.
func WithExportDelimiter ¶
func WithExportDelimiter(delimiter rune) ExportOption
WithExportDelimiter sets the field delimiter for export (default: comma).
func WithoutWriteHeader ¶
func WithoutWriteHeader() ExportOption
WithoutWriteHeader suppresses the header row in the exported CSV output.
type ImportOption ¶
type ImportOption func(*importConfig)
ImportOption configures the CSV importer behavior.
func WithComment ¶
func WithComment(comment rune) ImportOption
WithComment sets the comment character. Lines beginning with this rune are skipped by the CSV reader.
func WithImportDelimiter ¶
func WithImportDelimiter(delimiter rune) ImportOption
WithImportDelimiter sets the field delimiter (default: comma).
func WithSkipRows ¶
func WithSkipRows(rows int) ImportOption
WithSkipRows skips the first n rows before reading the header or data. Negative values are clamped to zero.
func WithoutHeader ¶
func WithoutHeader() ImportOption
WithoutHeader treats the first non-skipped row as data instead of headers. Columns are mapped to source positions in schema order.
func WithoutTrimSpace ¶
func WithoutTrimSpace() ImportOption
WithoutTrimSpace disables leading/trailing whitespace trimming on cell values. Trimming is enabled by default and affects empty-row detection, header matching, and cell value parsing.