query

package
v2.0.0-...-7567dab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package query defined types for representing flux query result

Index

Constants

This section is empty.

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 NewFluxColumn

func NewFluxColumn(index int) *FluxColumn

NewFluxColumn creates FluxColumn for position

func NewFluxColumnFull

func NewFluxColumnFull(dataType string, defaultValue string, name string, group bool, index int) *FluxColumn

NewFluxColumnFull creates FluxColumn

func (*FluxColumn) DataType

func (f *FluxColumn) DataType() string

DataType returns data type of the column

func (*FluxColumn) DefaultValue

func (f *FluxColumn) DefaultValue() string

DefaultValue returns default value of the column

func (*FluxColumn) Index

func (f *FluxColumn) Index() int

Index returns index of the column

func (*FluxColumn) IsGroup

func (f *FluxColumn) IsGroup() bool

IsGroup return true if the column is grouping column

func (*FluxColumn) Name

func (f *FluxColumn) Name() string

Name returns name of the column

func (*FluxColumn) SetDataType

func (f *FluxColumn) SetDataType(dataType string)

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(table int, values map[string]interface{}) *FluxRecord

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 value of the _result column, which represents result name. Returns empty string if there is no column "result".

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) Table

func (r *FluxRecord) Table() int

Table returns value of the table column It returns zero if the table column is not found

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 NewFluxTableMetadata

func NewFluxTableMetadata(position int) *FluxTableMetadata

NewFluxTableMetadata creates FluxTableMetadata for the table on position

func NewFluxTableMetadataFull

func NewFluxTableMetadataFull(position int, columns []*FluxColumn) *FluxTableMetadata

NewFluxTableMetadataFull creates FluxTableMetadata

func (*FluxTableMetadata) AddColumn

func (f *FluxTableMetadata) AddColumn(column *FluxColumn) *FluxTableMetadata

AddColumn adds column definition to table metadata

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) Position

func (f *FluxTableMetadata) Position() int

Position returns position of the table in the flux query result

func (*FluxTableMetadata) String

func (f *FluxTableMetadata) String() string

String returns FluxTableMetadata string dump

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL