writer

package
v0.0.0-...-cf8d022 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package writer exports frames to files. Each output format registers itself in the format registry via init().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(f Format, w Writer)

Register installs a writer for a format; called from init() in format files.

func SupportedFormats

func SupportedFormats() []string

SupportedFormats lists registered format names, sorted.

Types

type Compression

type Compression string

Compression names parquet compression codecs.

const (
	CompressionNone   Compression = "none"
	CompressionSnappy Compression = "snappy"
	CompressionGzip   Compression = "gzip"
	CompressionZstd   Compression = "zstd"
	CompressionLZ4    Compression = "lz4"
	CompressionBrotli Compression = "brotli"
)

type Format

type Format string

Format names a supported output format.

const (
	FormatCSV      Format = "csv"
	FormatTSV      Format = "tsv"
	FormatJSON     Format = "json"
	FormatJSONL    Format = "jsonl"
	FormatParquet  Format = "parquet"
	FormatMarkdown Format = "markdown"
)

type Options

type Options struct {
	Separator   rune        // csv field separator (default ',')
	Quote       rune        // csv quote char (default '"')
	Header      bool        // include header row (default true)
	Pretty      bool        // json: indent output
	Compression Compression // parquet codec (default snappy)
}

Options carries all export knobs; format writers pick what applies.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the option defaults shared by all formats.

type Writer

type Writer interface {
	Write(w io.Writer, f *data.Frame, opt Options) error
}

Writer serializes a frame in one format.

func For

func For(f Format) (Writer, error)

For returns the writer registered for a format.

Jump to

Keyboard shortcuts

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