Documentation ¶
Index ¶
- Variables
- func CompareRawdataWithInfluxResults(readRawdata *Common.ReadRawdata, results []Client.Result) error
- func InfluxResultToReadRawdata(results []Client.Result, query *Common.Query) *Common.ReadRawdata
- func ReadRawdata(config *Config, queries []*Common.Query) ([]*Common.ReadRawdata, error)
- func WriteRawdata(config *Config, writeRawdata []*Common.WriteRawdata) error
- type Config
- type Database
- type Field
- type Function
- type FunctionType
- type Functions
- type InfluxClient
- func (p *InfluxClient) CreateDatabase(db string, retry int) error
- func (p *InfluxClient) DeleteDatabase(db string) error
- func (p *InfluxClient) DeleteMeasurement(db, measurement string) error
- func (p *InfluxClient) MeasurementExist(db, measurement string) bool
- func (p *InfluxClient) ModifyDefaultRetentionPolicy(db string, retry int) error
- func (p *InfluxClient) Ping() error
- func (p *InfluxClient) QueryDB(cmd, database string) (res []Client.Result, err error)
- func (p *InfluxClient) WritePoints(points []*Client.Point, bpCfg Client.BatchPointsConfig) error
- type InfluxEntity
- type InfluxMeasurement
- type InfluxQuery
- func (p *InfluxQuery) AppendCondition(keys, values, operators []string, dataTypes []common.DataType)
- func (p *InfluxQuery) AppendConditionDirectly(condition string)
- func (p *InfluxQuery) AppendGroups(groups []string)
- func (p *InfluxQuery) AppendSelects(selects []string)
- func (p *InfluxQuery) BuildDropCmd() string
- func (p *InfluxQuery) BuildQueryCmd() string
- func (p *InfluxQuery) SetAggregateFunction()
- func (p *InfluxQuery) SetOrder(order common.Order)
- func (p *InfluxQuery) SetStep(step int)
- func (p *InfluxQuery) SetTimeRange(startTime, endTime *time.Time)
- type InfluxRow
- type Measurement
- type Statement
- func (s *Statement) AppendWhereClause(operator, key, op, value string)
- func (s *Statement) AppendWhereClauseByList(key string, operator string, listOperator string, values []string)
- func (s *Statement) AppendWhereClauseDirectly(operator, condition string)
- func (s *Statement) AppendWhereClauseFromTimeCondition()
- func (s *Statement) AppendWhereClauseWithTime(operator string, value int64)
- func (s *Statement) BuildDropCmd() string
- func (s *Statement) BuildQueryCmd() string
- func (s *Statement) Clear()
- func (s *Statement) GenerateCondition(keyList, valueList []string, op string) string
- func (s *Statement) GenerateConditionByList(conditionList []string, op string) string
- func (s *Statement) SetFunction(funcType FunctionType, funcName, target string)
- func (s *Statement) SetLimitClauseFromQueryCondition()
- func (s *Statement) SetOrderClauseFromQueryCondition()
- type Tag
Constants ¶
This section is empty.
Variables ¶
View Source
var AggregateFuncMap = map[common.AggregateFunction]Functions{ common.None: Last, common.MaxOverTime: Max, common.AvgOverTime: Mean, }
View Source
var FunctionNameMap = map[common.FunctionType]string{ common.NoneFunction: "", common.FunctionCount: "COUNT", common.FuncDistinct: "DISTINCT", common.FuncIntegral: "INTEGRAL", common.FunctionMean: "MEAN", common.FunctionMedian: "MEDIAN", common.FunctionMode: "MODE", common.FunctionSpread: "SPREAD", common.FunctionStddev: "STDDEV", common.FunctionSum: "SUM", common.FunctionBottom: "BOTTOM", common.FunctionFirst: "FIRST", common.FunctionLast: "LAST", common.FunctionMax: "MAX", common.FunctionMin: "MIN", common.FunctionPercentile: "PERCENTILE", common.FunctionSample: "SAMPLE", common.FunctionTop: "TOP", common.FuncDerivative: "DERIVATIVE", }
View Source
var ( // ZeroTime is used as a constant of timestamp ZeroTime = time.Unix(0, 0) )
Functions ¶
func CompareRawdataWithInfluxResults ¶
func CompareRawdataWithInfluxResults(readRawdata *Common.ReadRawdata, results []Client.Result) error
func ReadRawdata ¶
func WriteRawdata ¶
func WriteRawdata(config *Config, writeRawdata []*Common.WriteRawdata) error
Types ¶
type Config ¶
type Config struct { Address string `mapstructure:"address"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` InsecureSkipVerify bool `mapstructure:"insecureSkipVerify"` RetentionDuration string `mapstructure:"retentionDuration"` RetentionShardDuration string `mapstructure:"retentionShardDuration"` }
Configuration of InfluxDB data source
type Function ¶ added in v0.9.166
type Function struct { FuncType FunctionType FuncName string Target string }
type FunctionType ¶ added in v0.9.166
type FunctionType int
const ( NoneFunction FunctionType = iota Aggregate Select )
type InfluxClient ¶
type InfluxClient struct { Address string Username string Password string RetentionDuration string RetentionShardDuration string }
InfluxDB client interacts with database
func NewClient ¶
func NewClient(influxCfg *Config) *InfluxClient
Instance InfluxDB API client with configuration
func (*InfluxClient) CreateDatabase ¶
func (p *InfluxClient) CreateDatabase(db string, retry int) error
Create database
func (*InfluxClient) DeleteDatabase ¶ added in v0.9.1
func (p *InfluxClient) DeleteDatabase(db string) error
Delete database
func (*InfluxClient) DeleteMeasurement ¶ added in v0.9.1
func (p *InfluxClient) DeleteMeasurement(db, measurement string) error
Delete measurement
func (*InfluxClient) MeasurementExist ¶ added in v0.9.166
func (p *InfluxClient) MeasurementExist(db, measurement string) bool
func (*InfluxClient) ModifyDefaultRetentionPolicy ¶
func (p *InfluxClient) ModifyDefaultRetentionPolicy(db string, retry int) error
Modify default retention policy
func (*InfluxClient) Ping ¶ added in v0.9.1
func (p *InfluxClient) Ping() error
func (*InfluxClient) QueryDB ¶
func (p *InfluxClient) QueryDB(cmd, database string) (res []Client.Result, err error)
Query database
func (*InfluxClient) WritePoints ¶
func (p *InfluxClient) WritePoints(points []*Client.Point, bpCfg Client.BatchPointsConfig) error
Write points to database
type InfluxEntity ¶
type InfluxMeasurement ¶ added in v0.9.166
type InfluxMeasurement struct { *schemas.Measurement Database string Client *InfluxClient }
func NewMeasurement ¶ added in v0.9.166
func NewMeasurement(database string, measurement *schemas.Measurement, config Config) *InfluxMeasurement
func (*InfluxMeasurement) Drop ¶ added in v0.9.166
func (p *InfluxMeasurement) Drop(query *InfluxQuery) error
func (*InfluxMeasurement) Read ¶ added in v0.9.166
func (p *InfluxMeasurement) Read(query *InfluxQuery) ([]*common.Group, error)
type InfluxQuery ¶ added in v0.9.166
type InfluxQuery struct { QueryCondition *common.QueryCondition Measurement string Conditions []string }
func NewQuery ¶ added in v0.9.166
func NewQuery(queryCondition *common.QueryCondition, measurement string) *InfluxQuery
func (*InfluxQuery) AppendCondition ¶ added in v0.9.166
func (p *InfluxQuery) AppendCondition(keys, values, operators []string, dataTypes []common.DataType)
func (*InfluxQuery) AppendConditionDirectly ¶ added in v0.9.166
func (p *InfluxQuery) AppendConditionDirectly(condition string)
func (*InfluxQuery) AppendGroups ¶ added in v0.9.166
func (p *InfluxQuery) AppendGroups(groups []string)
func (*InfluxQuery) AppendSelects ¶ added in v0.9.166
func (p *InfluxQuery) AppendSelects(selects []string)
func (*InfluxQuery) BuildDropCmd ¶ added in v0.9.166
func (p *InfluxQuery) BuildDropCmd() string
func (*InfluxQuery) BuildQueryCmd ¶ added in v0.9.166
func (p *InfluxQuery) BuildQueryCmd() string
func (*InfluxQuery) SetAggregateFunction ¶ added in v0.9.166
func (p *InfluxQuery) SetAggregateFunction()
func (*InfluxQuery) SetOrder ¶ added in v0.9.166
func (p *InfluxQuery) SetOrder(order common.Order)
func (*InfluxQuery) SetStep ¶ added in v0.9.166
func (p *InfluxQuery) SetStep(step int)
func (*InfluxQuery) SetTimeRange ¶ added in v0.9.166
func (p *InfluxQuery) SetTimeRange(startTime, endTime *time.Time)
type InfluxRow ¶
func NormalizeResult ¶
func ReadRawdataToInfluxDBRow ¶
func ReadRawdataToInfluxDBRow(readRawdata *Common.ReadRawdata) []*InfluxRow
type Measurement ¶
type Measurement string
type Statement ¶
type Statement struct { QueryCondition *DBCommon.QueryCondition Database Database Measurement Measurement SelectedFields []string GroupByTags []string Function *Function WhereClause string TimeClause string OrderClause string LimitClause string }
func NewStatement ¶
func (*Statement) AppendWhereClause ¶
func (*Statement) AppendWhereClauseByList ¶ added in v0.3.53
func (*Statement) AppendWhereClauseDirectly ¶
func (*Statement) AppendWhereClauseFromTimeCondition ¶
func (s *Statement) AppendWhereClauseFromTimeCondition()
func (*Statement) AppendWhereClauseWithTime ¶
func (*Statement) BuildDropCmd ¶ added in v0.9.166
func (*Statement) BuildQueryCmd ¶
func (*Statement) GenerateCondition ¶ added in v0.9.166
func (*Statement) GenerateConditionByList ¶ added in v0.9.166
func (*Statement) SetFunction ¶ added in v0.9.166
func (s *Statement) SetFunction(funcType FunctionType, funcName, target string)
func (*Statement) SetLimitClauseFromQueryCondition ¶
func (s *Statement) SetLimitClauseFromQueryCondition()
func (*Statement) SetOrderClauseFromQueryCondition ¶
func (s *Statement) SetOrderClauseFromQueryCondition()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.