Documentation ¶
Index ¶
- Constants
- type ColType
- type FluxColumn
- func (f *FluxColumn) DataType() ColType
- func (f *FluxColumn) DefaultValue() string
- func (f *FluxColumn) IsGroup() bool
- func (f *FluxColumn) Name() string
- func (f *FluxColumn) SetDataType(dataType ColType)
- func (f *FluxColumn) SetDefaultValue(defaultValue string)
- func (f *FluxColumn) SetGroup(group bool)
- func (f *FluxColumn) SetName(name string)
- func (f *FluxColumn) String() string
- type FluxRecord
- func (r *FluxRecord) Field() string
- func (r *FluxRecord) Measurement() string
- func (r *FluxRecord) Result() string
- func (r *FluxRecord) Start() time.Time
- func (r *FluxRecord) Stop() time.Time
- func (r *FluxRecord) String() string
- func (r *FluxRecord) TableId() int64
- func (r *FluxRecord) Time() time.Time
- func (r *FluxRecord) Value() interface{}
- func (r *FluxRecord) ValueByKey(key string) interface{}
- func (r *FluxRecord) Values() map[string]interface{}
- type FluxTableMetadata
- func (f *FluxTableMetadata) Column(index int) *FluxColumn
- func (f *FluxTableMetadata) Columns() []FluxColumn
- func (f *FluxTableMetadata) GroupKeyCols() []string
- func (f *FluxTableMetadata) ResultColumn() *FluxColumn
- func (f *FluxTableMetadata) String() string
- func (f *FluxTableMetadata) TableIdColumn() *FluxColumn
- type QueryTableResult
- func (q *QueryTableResult) AnnotationsChanged() bool
- func (q *QueryTableResult) Err() error
- func (q *QueryTableResult) Metadata() *FluxTableMetadata
- func (q *QueryTableResult) Next() bool
- func (q *QueryTableResult) Record() *FluxRecord
- func (q *QueryTableResult) ResultChanged() bool
- func (q *QueryTableResult) TableIdChanged() bool
Constants ¶
const ( ResultCol = "result" TableIdCol = "table" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FluxColumn ¶
type FluxColumn struct {
// contains filtered or unexported fields
}
FluxColumn holds flux query table column properties
func NewFluxColumnFull ¶
func NewFluxColumnFull(dataType ColType, defaultValue string, name string, group bool) *FluxColumn
NewFluxColumnFull creates FluxColumn
func (*FluxColumn) DataType ¶
func (f *FluxColumn) DataType() ColType
DataType returns data type of the column
func (*FluxColumn) DefaultValue ¶
func (f *FluxColumn) DefaultValue() string
DefaultValue returns default value of the column
func (*FluxColumn) IsGroup ¶
func (f *FluxColumn) IsGroup() bool
IsGroup return true if the column is grouping column
func (*FluxColumn) SetDataType ¶
func (f *FluxColumn) SetDataType(dataType ColType)
SetDataType sets data type for the column
func (*FluxColumn) SetDefaultValue ¶
func (f *FluxColumn) SetDefaultValue(defaultValue string)
SetDefaultValue sets default value for the column
func (*FluxColumn) SetGroup ¶
func (f *FluxColumn) SetGroup(group bool)
SetGroup set group flag for the column
func (*FluxColumn) SetName ¶
func (f *FluxColumn) SetName(name string)
SetName sets name of the column
func (*FluxColumn) String ¶
func (f *FluxColumn) String() string
String returns FluxColumn string dump
type FluxRecord ¶
type FluxRecord struct {
// contains filtered or unexported fields
}
FluxRecord represents row in the flux query result table
func NewFluxRecord ¶
func NewFluxRecord(metadata *FluxTableMetadata, values map[string]interface{}) (*FluxRecord, error)
NewFluxRecord returns new record for the table with values
func (*FluxRecord) Field ¶
func (r *FluxRecord) Field() string
Field returns the field name. Returns empty string if there is no column "_field".
func (*FluxRecord) Measurement ¶
func (r *FluxRecord) Measurement() string
Measurement returns the measurement name of the record Returns empty string if there is no column "_measurement".
func (*FluxRecord) Result ¶
func (r *FluxRecord) Result() string
Result returns the name of the result containing this record as specified by the query.
func (*FluxRecord) Start ¶
func (r *FluxRecord) Start() time.Time
Start returns the inclusive lower time bound of all records in the current table. Returns empty time.Time if there is no column "_start".
func (*FluxRecord) Stop ¶
func (r *FluxRecord) Stop() time.Time
Stop returns the exclusive upper time bound of all records in the current table. Returns empty time.Time if there is no column "_stop".
func (*FluxRecord) String ¶
func (r *FluxRecord) String() string
String returns FluxRecord string dump
func (*FluxRecord) TableId ¶
func (r *FluxRecord) TableId() int64
TableId returns index of the table record belongs to within its result.
func (*FluxRecord) Time ¶
func (r *FluxRecord) Time() time.Time
Time returns the time of the record. Returns empty time.Time if there is no column "_time".
func (*FluxRecord) Value ¶
func (r *FluxRecord) Value() interface{}
Value returns the default _value column value or nil if not present
func (*FluxRecord) ValueByKey ¶
func (r *FluxRecord) ValueByKey(key string) interface{}
ValueByKey returns value for given column key for the record or nil of result has no value the column key
func (*FluxRecord) Values ¶
func (r *FluxRecord) Values() map[string]interface{}
Values returns map of the values where key is the column name
type FluxTableMetadata ¶
type FluxTableMetadata struct {
// contains filtered or unexported fields
}
FluxTableMetadata holds flux query result table information represented by collection of columns. Each new table is introduced by annotations
func NewFluxTableMetadataFull ¶
func NewFluxTableMetadataFull(columns ...*FluxColumn) *FluxTableMetadata
NewFluxTableMetadataFull creates FluxTableMetadata containing the given columns
func (*FluxTableMetadata) Column ¶
func (f *FluxTableMetadata) Column(index int) *FluxColumn
Column returns flux table column by index. Returns nil if index is out of the bounds.
func (*FluxTableMetadata) Columns ¶
func (f *FluxTableMetadata) Columns() []FluxColumn
Columns returns slice of flux query result table
func (*FluxTableMetadata) GroupKeyCols ¶
func (f *FluxTableMetadata) GroupKeyCols() []string
GroupKeyCols returns the names of the grouping columns in the table, sorted in ascending order.
func (*FluxTableMetadata) ResultColumn ¶
func (f *FluxTableMetadata) ResultColumn() *FluxColumn
ResultColumn returns metadata about the column naming results as specified by the query
func (*FluxTableMetadata) String ¶
func (f *FluxTableMetadata) String() string
String returns FluxTableMetadata string dump
func (*FluxTableMetadata) TableIdColumn ¶
func (f *FluxTableMetadata) TableIdColumn() *FluxColumn
TableIdColumn returns metadata about the column tracking table IDs within a result
type QueryTableResult ¶
QueryTableResult parses streamed flux query response into structures representing flux table parts Walking though the result is done by repeatedly calling Next() until returns false. Actual flux table info (columns with names, data types, etc) is returned by TableMetadata() method. Data are acquired by Record() method. Preliminary end can be caused by an error, so when Next() return false, check Err() for an error
func NewQueryTableResult ¶
func NewQueryTableResult(rawResponse io.ReadCloser) *QueryTableResult
func (*QueryTableResult) AnnotationsChanged ¶
func (q *QueryTableResult) AnnotationsChanged() bool
AnnotationsChanged returns true if last call of Next() found new CSV annotations
func (*QueryTableResult) Err ¶
func (q *QueryTableResult) Err() error
Err returns an error raised during flux query response parsing
func (*QueryTableResult) Metadata ¶
func (q *QueryTableResult) Metadata() *FluxTableMetadata
Metadata returns table-level info for last parsed flux table data row
func (*QueryTableResult) Next ¶
func (q *QueryTableResult) Next() bool
Next advances to next row in query result. During the first time it is called, Next creates also table metadata Actual parsed row is available through Record() function Returns false in case of end or an error, otherwise true
func (*QueryTableResult) Record ¶
func (q *QueryTableResult) Record() *FluxRecord
Record returns last parsed flux table data row Use Record methods to access value and row properties
func (*QueryTableResult) ResultChanged ¶
func (q *QueryTableResult) ResultChanged() bool
ResultChanged returns true if the last call of Next() found a new query result
func (*QueryTableResult) TableIdChanged ¶
func (q *QueryTableResult) TableIdChanged() bool
TableIdChanged returns true if the last call of Next() found a new table within the query result