influxdb

package
v4.2.719+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 InfluxResultToReadRawdata

func InfluxResultToReadRawdata(results []Client.Result, query *Common.Query) *Common.ReadRawdata

func ReadRawdata

func ReadRawdata(config *Config, queries []*Common.Query) ([]*Common.ReadRawdata, error)

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

func NewDefaultConfig

func NewDefaultConfig() *Config

Provide default configuration for InfluxDB

func (*Config) Validate

func (c *Config) Validate() error

Confirm the InfluxDB configuration is validated

type Database

type Database string

type Field added in v0.9.166

type Field string

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 Functions added in v0.9.166

type Functions = string
const (
	Last Functions = "LAST"
	Mean Functions = "MEAN"
	Max  Functions = "MAX"
)

Influxdb function definition

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 InfluxEntity struct {
	Time   time.Time
	Tags   map[string]string
	Fields map[string]interface{}
}

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)

func (*InfluxMeasurement) Write added in v0.9.166

func (p *InfluxMeasurement) Write(columns []string, rows []*common.Row) 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

type InfluxRow struct {
	Name    string
	Tags    map[string]string
	Data    []map[string]string
	Partial bool
}

func NormalizeResult

func NormalizeResult(rows []*InfluxRow) []*InfluxRow

func PackMap

func PackMap(results []Client.Result) []*InfluxRow

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 NewStatement(query *Common.Query) *Statement

func (*Statement) AppendWhereClause

func (s *Statement) AppendWhereClause(operator, key, op, value string)

func (*Statement) AppendWhereClauseByList added in v0.3.53

func (s *Statement) AppendWhereClauseByList(key string, operator string, listOperator string, values []string)

func (*Statement) AppendWhereClauseDirectly

func (s *Statement) AppendWhereClauseDirectly(operator, condition string)

func (*Statement) AppendWhereClauseFromTimeCondition

func (s *Statement) AppendWhereClauseFromTimeCondition()

func (*Statement) AppendWhereClauseWithTime

func (s *Statement) AppendWhereClauseWithTime(operator string, value int64)

func (*Statement) BuildDropCmd added in v0.9.166

func (s *Statement) BuildDropCmd() string

func (*Statement) BuildQueryCmd

func (s *Statement) BuildQueryCmd() string

func (*Statement) Clear added in v0.9.166

func (s *Statement) Clear()

func (*Statement) GenerateCondition added in v0.9.166

func (s *Statement) GenerateCondition(keyList, valueList []string, op string) string

func (*Statement) GenerateConditionByList added in v0.9.166

func (s *Statement) GenerateConditionByList(conditionList []string, op string) string

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

type Tag added in v0.9.166

type Tag string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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