package line

import "github.com/influxdata/flux/internal/line"

Index

Types

type ResultDecoder

type ResultDecoder struct {
	// contains filtered or unexported fields
}

ResultDecoder decodes raw input strings from a reader into a flux.Result. It uses a separator to split the input into tokens and generate table rows. Tokens are kept as they are and put into a table with schema `_time`, `_value`. The `_value` column contains tokens. The `_time` column contains the timestamps for when each `_value` has been read. Strings in `_value` are obtained from the io.Reader passed to the Decode function. ResultDecoder outputs one table once the reader reaches EOF.

func NewResultDecoder

func NewResultDecoder(config *ResultDecoderConfig) *ResultDecoder

NewResultDecoder creates a new result decoder from config.

func (*ResultDecoder) Decode

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

func (*ResultDecoder) Do

func (rd *ResultDecoder) Do(f func(flux.Table) error) error

func (*ResultDecoder) Name

func (*ResultDecoder) Name() string

func (*ResultDecoder) Tables

func (rd *ResultDecoder) Tables() flux.TableIterator

type ResultDecoderConfig

type ResultDecoderConfig struct {
	Separator    byte
	TimeProvider TimeProvider
}

ResultDecoderConfig is the configuration for a result decoder.

type TimeProvider

type TimeProvider interface {
	CurrentTime() values.Time
}

TimeProvider gives the current time.

Source Files

result.go

Version
v0.196.1 (latest)
Published
Feb 19, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
1 day ago

Tools for package owners.