Documentation
¶
Index ¶
- Constants
- func CsvToProtocolLines(reader io.Reader) io.Reader
- func IsTypeSupported(dataType string) bool
- func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)
- type Batcher
- type CsvColumnError
- type CsvLineError
- type CsvTable
- func (t *CsvTable) AddRow(row []string) bool
- func (t *CsvTable) AppendLine(buffer []byte, row []string) ([]byte, error)
- func (t *CsvTable) Column(label string) *CsvTableColumn
- func (t *CsvTable) Columns() []CsvTableColumn
- func (t *CsvTable) CreateLine(row []string) (line string, err error)
- func (t *CsvTable) FieldName() *CsvTableColumn
- func (t *CsvTable) FieldValue() *CsvTableColumn
- func (t *CsvTable) Fields() []CsvTableColumn
- func (t *CsvTable) Measurement() *CsvTableColumn
- func (t *CsvTable) Tags() []CsvTableColumn
- func (t *CsvTable) Time() *CsvTableColumn
- type CsvTableColumn
Constants ¶
const ( // DefaultMaxBytes is 500KB; this is typically 250 to 500 lines. DefaultMaxBytes = 500000 // DefaultInterval will flush every 10 seconds. DefaultInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CsvToProtocolLines ¶
CsvToProtocolLines transforms csv data into line protocol data
func IsTypeSupported ¶
IsTypeSupported returns true if the data type is supported
Types ¶
type Batcher ¶
type Batcher struct {
MaxFlushBytes int // MaxFlushBytes is the maximum number of bytes to buffer before flushing
MaxFlushInterval time.Duration // MaxFlushInterval is the maximum amount of time to wait before flushing
Service platform.WriteService // Service receives batches flushed from Batcher.
}
Batcher batches line protocol for sends to output.
type CsvColumnError ¶
CsvColumnError indicates conversion in a specific column
func (CsvColumnError) Error ¶
func (e CsvColumnError) Error() string
type CsvLineError ¶
CsvLineError is returned for csv conversion errors Line numbers are 1-indexed
func (CsvLineError) Error ¶
func (e CsvLineError) Error() string
type CsvTable ¶
type CsvTable struct {
// contains filtered or unexported fields
}
CsvTable gathers metadata about columns
func (*CsvTable) AppendLine ¶
AppendLine appends a protocol line to the supplied buffer and returns appended buffer or an error if any
func (*CsvTable) Column ¶
func (t *CsvTable) Column(label string) *CsvTableColumn
Column returns the first column of the supplied label or nil
func (*CsvTable) Columns ¶
func (t *CsvTable) Columns() []CsvTableColumn
Columns returns available columns
func (*CsvTable) CreateLine ¶
CreateLine produces a protocol line out of the supplied row or returns error
func (*CsvTable) FieldName ¶
func (t *CsvTable) FieldName() *CsvTableColumn
FieldName returns field name column or nil
func (*CsvTable) FieldValue ¶
func (t *CsvTable) FieldValue() *CsvTableColumn
FieldValue returns field value column or nil
func (*CsvTable) Measurement ¶
func (t *CsvTable) Measurement() *CsvTableColumn
Measurement returns measurement column or nil
type CsvTableColumn ¶
type CsvTableColumn struct {
// label such as "_start", "_stop", "_time"
Label string
// "string", "long", "dateTime:RFC3339" ...
DataType string
// column's line part (0 means not determined), see linePart constants
LinePart int
// default value to be used for rows where value is an empty string.
DefaultValue string
// index of this column in the table row
Index int
// contains filtered or unexported fields
}
CsvTableColumn represents metadata of a csv column
func (*CsvTableColumn) LineLabel ¶
func (c *CsvTableColumn) LineLabel() string
LineLabel returns escaped column name so that it can be used as tag name or field name in line protocol