Documentation
¶
Index ¶
- func CsvToProtocolLines(reader io.Reader) io.Reader
- func IsTypeSupported(dataType string) bool
- 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 ¶
This section is empty.
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 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 and error indication
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 of the supplied row or returned 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