Documentation ¶
Index ¶
- func EscapeQuotes(val string) string
- type Encoder
- type EncoderFunc
- type Format
- type FormatDetectionConfig
- type Padding
- type Writer
- func (w *Writer[T]) Delimiter() rune
- func (w *Writer[T]) Encoder() Encoder
- func (w *Writer[T]) EscapeQuotes() string
- func (w *Writer[T]) NewLine() string
- func (w *Writer[T]) NilValue() string
- func (w *Writer[T]) QuoteAllFields() bool
- func (w *Writer[T]) QuoteEmptyFields() bool
- func (w *Writer[T]) ViewStrings(ctx context.Context, view retable.View) ([][]string, error)
- func (w *Writer[T]) WithColumnFormatter(columnIndex int, formatter retable.CellFormatter) *Writer[T]
- func (w *Writer[T]) WithColumnFormatterFunc(columnIndex int, formatterFunc retable.CellFormatterFunc) *Writer[T]
- func (w *Writer[T]) WithDelimiter(delimiter rune) *Writer[T]
- func (w *Writer[T]) WithEncoder(encoder Encoder) *Writer[T]
- func (w *Writer[T]) WithEscapeQuotes(escapeQuotes string) *Writer[T]
- func (w *Writer[T]) WithHeaderRow(headerRow bool) *Writer[T]
- func (w *Writer[T]) WithInterfaceTypeFormatter(typ reflect.Type, fmt retable.CellFormatter) *Writer[T]
- func (w *Writer[T]) WithInterfaceTypeFormatterFunc(typ reflect.Type, fmt retable.CellFormatterFunc) *Writer[T]
- func (w *Writer[T]) WithKindFormatter(kind reflect.Kind, fmt retable.CellFormatter) *Writer[T]
- func (w *Writer[T]) WithKindFormatterFunc(kind reflect.Kind, fmt retable.CellFormatterFunc) *Writer[T]
- func (w *Writer[T]) WithNewLine(newLine string) *Writer[T]
- func (w *Writer[T]) WithNilValue(nilValue string) *Writer[T]
- func (w *Writer[T]) WithPadding(padding Padding) *Writer[T]
- func (w *Writer[T]) WithQuoteAllFields(quoteAllFields bool) *Writer[T]
- func (w *Writer[T]) WithQuoteEmptyFields(quoteEmptyFields bool) *Writer[T]
- func (w *Writer[T]) WithTableViewer(viewer retable.Viewer) *Writer[T]
- func (w *Writer[T]) WithTypeFormatter(typ reflect.Type, fmt retable.CellFormatter) *Writer[T]
- func (w *Writer[T]) WithTypeFormatterFunc(typ reflect.Type, fmt retable.CellFormatterFunc) *Writer[T]
- func (w *Writer[T]) WithTypeFormatterReflectFunc(function any) *Writer[T]
- func (w *Writer[T]) WithTypeFormatterReflectRawFunc(function any) *Writer[T]
- func (w *Writer[T]) WithTypeFormatters(formatter *retable.ReflectTypeCellFormatter) *Writer[T]
- func (w *Writer[T]) Write(ctx context.Context, dest io.Writer, table T) error
- func (w *Writer[T]) WriteView(ctx context.Context, dest io.Writer, view retable.View) error
- func (w *Writer[T]) WriteWithViewer(ctx context.Context, dest io.Writer, viewer retable.Viewer, table T) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeQuotes ¶
Types ¶
type Encoder ¶
Encoder is an interface to encode byte strings.
func PassthroughEncoder ¶
func PassthroughEncoder() Encoder
PassthroughEncoder returns an Encoder that returns the passed data unchanged.
type EncoderFunc ¶
EncoderFunc implements the Encoder interface for a function.
type Format ¶
type Format struct { Encoding string `json:"encoding"` Separator string `json:"separator"` Newline string `json:"newline"` }
type FormatDetectionConfig ¶
type FormatDetectionConfig struct { Encodings []string `json:"encodings"` EncodingTests []string `json:"encodingTests"` }
func NewFormatDetectionConfig ¶
func NewFormatDetectionConfig() *FormatDetectionConfig
type Writer ¶
type Writer[T any] struct { // contains filtered or unexported fields }
func (*Writer[T]) EscapeQuotes ¶
func (*Writer[T]) QuoteAllFields ¶
func (*Writer[T]) QuoteEmptyFields ¶
func (*Writer[T]) ViewStrings ¶
ViewStrings returns the view formatted as a slice of string slices.
func (*Writer[T]) WithColumnFormatter ¶
func (w *Writer[T]) WithColumnFormatter(columnIndex int, formatter retable.CellFormatter) *Writer[T]
WithColumnFormatter returns a new writer with the passed formatter registered for columnIndex. If nil is passed as formatter, then a previous registered column formatter is removed.
func (*Writer[T]) WithColumnFormatterFunc ¶
func (w *Writer[T]) WithColumnFormatterFunc(columnIndex int, formatterFunc retable.CellFormatterFunc) *Writer[T]
WithColumnFormatterFunc returns a new writer with the passed formatterFunc registered for columnIndex. If nil is passed as formatterFunc, then a previous registered column formatter is removed.
func (*Writer[T]) WithDelimiter ¶
func (*Writer[T]) WithEncoder ¶
func (*Writer[T]) WithEscapeQuotes ¶
func (*Writer[T]) WithHeaderRow ¶
func (*Writer[T]) WithInterfaceTypeFormatter ¶
func (*Writer[T]) WithInterfaceTypeFormatterFunc ¶
func (*Writer[T]) WithKindFormatter ¶
func (*Writer[T]) WithKindFormatterFunc ¶
func (*Writer[T]) WithNewLine ¶
func (*Writer[T]) WithNilValue ¶
func (*Writer[T]) WithPadding ¶
func (*Writer[T]) WithQuoteAllFields ¶
func (*Writer[T]) WithQuoteEmptyFields ¶
func (*Writer[T]) WithTableViewer ¶
func (*Writer[T]) WithTypeFormatter ¶
func (*Writer[T]) WithTypeFormatterFunc ¶
func (*Writer[T]) WithTypeFormatterReflectFunc ¶
func (*Writer[T]) WithTypeFormatterReflectRawFunc ¶
func (*Writer[T]) WithTypeFormatters ¶
func (*Writer[T]) Write ¶
Write calls WriteView with the result of Viewer.NewView(table) using the writer's viewer if not nil or else retable.DefaultViewer.