flux: github.com/influxdata/flux/csv Index | Files

package csv

import "github.com/influxdata/flux/csv"

Package csv contains the csv result encoders and decoders.


Package Files

dialect.go result.go


const DialectType = "csv"

func AddDialectMappings Uses

func AddDialectMappings(mappings flux.DialectMappings) error

AddDialectMappings adds the influxql specific dialect mappings.

func NewMultiResultEncoder Uses

func NewMultiResultEncoder(c ResultEncoderConfig) flux.MultiResultEncoder

type Dialect Uses

type Dialect struct {

Dialect describes the output format of queries in CSV.

func DefaultDialect Uses

func DefaultDialect() *Dialect

func (Dialect) DialectType Uses

func (d Dialect) DialectType() flux.DialectType

func (Dialect) Encoder Uses

func (d Dialect) Encoder() flux.MultiResultEncoder

func (Dialect) SetHeaders Uses

func (d Dialect) SetHeaders(w http.ResponseWriter)

type MultiResultDecoder Uses

type MultiResultDecoder struct {
    // contains filtered or unexported fields

MultiResultDecoder reads multiple results from a single csv file. Results are delimited by an empty line.

func NewMultiResultDecoder Uses

func NewMultiResultDecoder(c ResultDecoderConfig) *MultiResultDecoder

NewMultiResultDecoder creates a new MultiResultDecoder.

func (*MultiResultDecoder) Decode Uses

func (d *MultiResultDecoder) Decode(r io.ReadCloser) (flux.ResultIterator, error)

type ResultDecoder Uses

type ResultDecoder struct {
    // contains filtered or unexported fields

ResultDecoder decodes a csv representation of a result.

func NewResultDecoder Uses

func NewResultDecoder(c ResultDecoderConfig) *ResultDecoder

NewResultDecoder creates a new ResultDecoder.

func (*ResultDecoder) Decode Uses

func (d *ResultDecoder) Decode(r io.Reader) (flux.Result, error)

type ResultDecoderConfig Uses

type ResultDecoderConfig struct {
    // NoHeader indicates that the CSV data will not have a header row.
    NoHeader bool
    // MaxBufferCount is the maximum number of rows that will be buffered when decoding.
    // If 0, then a value of 1000 will be used.
    MaxBufferCount int
    // Allocator is the memory allocator that will be used during decoding.
    // The default is to use an unlimited allocator when this is not set.
    Allocator *memory.Allocator

ResultDecoderConfig are options that can be specified on the ResultDecoder.

type ResultEncoder Uses

type ResultEncoder struct {
    // contains filtered or unexported fields

func NewResultEncoder Uses

func NewResultEncoder(c ResultEncoderConfig) *ResultEncoder

NewResultEncoder creates a new encoder with the provided configuration.

func (*ResultEncoder) Encode Uses

func (e *ResultEncoder) Encode(w io.Writer, result flux.Result) (int64, error)

func (*ResultEncoder) EncodeError Uses

func (e *ResultEncoder) EncodeError(w io.Writer, err error) error

type ResultEncoderConfig Uses

type ResultEncoderConfig struct {
    // Annotations is a list of annotations to include.
    Annotations []string

    // NoHeader indicates whether a header row should be added.
    NoHeader bool

    // Delimiter is the character to delimite columns.
    // It must not be \r, \n, or the Unicode replacement character (0xFFFD).
    Delimiter rune

ResultEncoderConfig are options that can be specified on the ResultEncoder.

func DefaultEncoderConfig Uses

func DefaultEncoderConfig() ResultEncoderConfig

func (ResultEncoderConfig) MarshalJSON Uses

func (c ResultEncoderConfig) MarshalJSON() ([]byte, error)

func (*ResultEncoderConfig) UnmarshalJSON Uses

func (c *ResultEncoderConfig) UnmarshalJSON(b []byte) error

Package csv imports 19 packages (graph) and is imported by 13 packages. Updated 2020-02-17. Refresh now. Tools for package owners.