Documentation ¶
Overview ¶
Package csv contains the csv result encoders and decoders.
Index ¶
Constants ¶
View Source
const DialectType = "csv"
Variables ¶
This section is empty.
Functions ¶
func AddDialectMappings ¶
func AddDialectMappings(mappings flux.DialectMappings) error
AddDialectMappings adds the influxql specific dialect mappings.
func NewMultiResultEncoder ¶
func NewMultiResultEncoder(c ResultEncoderConfig) flux.MultiResultEncoder
Types ¶
type Dialect ¶
type Dialect struct {
ResultEncoderConfig
}
Dialect describes the output format of queries in CSV.
func DefaultDialect ¶
func DefaultDialect() *Dialect
func (Dialect) DialectType ¶
func (d Dialect) DialectType() flux.DialectType
func (Dialect) Encoder ¶
func (d Dialect) Encoder() flux.MultiResultEncoder
func (Dialect) SetHeaders ¶
func (d Dialect) SetHeaders(w http.ResponseWriter)
type MultiResultDecoder ¶
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 ¶
func NewMultiResultDecoder(c ResultDecoderConfig) *MultiResultDecoder
NewMultiResultDecoder creates a new MultiResultDecoder.
func (*MultiResultDecoder) Decode ¶
func (d *MultiResultDecoder) Decode(r io.ReadCloser) (flux.ResultIterator, error)
type ResultDecoder ¶
type ResultDecoder struct {
// contains filtered or unexported fields
}
ResultDecoder decodes a csv representation of a result.
func NewResultDecoder ¶
func NewResultDecoder(c ResultDecoderConfig) *ResultDecoder
NewResultDecoder creates a new ResultDecoder.
type ResultDecoderConfig ¶
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 }
ResultDecoderConfig are options that can be specified on the ResultDecoder.
type ResultEncoder ¶
type ResultEncoder struct {
// contains filtered or unexported fields
}
func NewResultEncoder ¶
func NewResultEncoder(c ResultEncoderConfig) *ResultEncoder
NewResultEncoder creates a new encoder with the provided configuration.
func (*ResultEncoder) EncodeError ¶
func (e *ResultEncoder) EncodeError(w io.Writer, err error) error
type ResultEncoderConfig ¶
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 ¶
func DefaultEncoderConfig() ResultEncoderConfig
func (ResultEncoderConfig) MarshalJSON ¶
func (c ResultEncoderConfig) MarshalJSON() ([]byte, error)
func (*ResultEncoderConfig) UnmarshalJSON ¶
func (c *ResultEncoderConfig) UnmarshalJSON(b []byte) error
Click to show internal directories.
Click to hide internal directories.