format

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package format dispatches tabular Reader construction by format identifier, sitting between the io/ interface definitions and the per-format leaf packages (io/csv, io/tsv, io/ndjson, io/jsonarray, io/parquet, io/arrow, io/excel). It exists as a sub-package of io/ to avoid an import cycle: io/csv (and siblings) already import io/ for the Reader / ResetReader interfaces, so the dispatch table cannot live in io/ itself.

Index

Constants

View Source
const (
	CSV       = "csv"
	TSV       = "tsv"
	NDJSON    = "ndjson"
	JSONArray = "jsonarray"
	Parquet   = "parquet"
	Arrow     = "arrow"
	Excel     = "excel"
	Pulse     = "pulse"
)

Format identifiers for tabular sources Pulse can ingest. The empty string represents an unrecognised extension. "pulse" is reserved for the engine's native binary format — readers are not constructed for it; callers detect it and use it directly.

Variables

View Source
var SupportedImport = []string{
	CSV,
	TSV,
	NDJSON,
	JSONArray,
	Parquet,
	Arrow,
	Excel,
}

SupportedImport lists every format NewReader accepts. Excludes "pulse" (native, no conversion needed) and the empty string. Order is stable for deterministic documentation and CLI help output.

Functions

func FromExt

func FromExt(path string) string

FromExt returns the canonical format identifier for a file path based on its extension. Returns the empty string when the extension is not recognised — callers that need an error should wrap with their own diagnostic.

func NewReader

func NewReader(format string, fs afero.Fs, path string, opts ReaderOptions) (pio.Reader, error)

NewReader constructs a tabular Reader for the given format, reading from path on fs. The returned Reader implements pio.ResetReader for every supported format, so schema inference + import is always available. Returns an error for the native pulse format (no tabular reader needed) and for unknown / empty formats.

Types

type ReaderOptions

type ReaderOptions struct {
	Sheet string
}

ReaderOptions modulate reader construction. Currently only Excel honours Sheet; other formats ignore it silently.

Jump to

Keyboard shortcuts

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