influxdb

package
v4.2.294+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: Apache-2.0 Imports: 12 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 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) 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) ModifyDefaultRetentionPolicy

func (p *InfluxClient) ModifyDefaultRetentionPolicy(db string) 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 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
	WhereClause    string
	OrderClause    string
	LimitClause    string
}

func NewStatement

func NewStatement(query *Common.Query) *Statement

func (*Statement) AppendWhereClause

func (s *Statement) AppendWhereClause(key string, operator string, 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(condition string)

func (*Statement) AppendWhereClauseFromTimeCondition

func (s *Statement) AppendWhereClauseFromTimeCondition()

func (*Statement) AppendWhereClauseWithTime

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

func (Statement) BuildQueryCmd

func (s Statement) BuildQueryCmd() string

func (*Statement) SetLimitClauseFromQueryCondition

func (s *Statement) SetLimitClauseFromQueryCondition()

func (*Statement) SetOrderClauseFromQueryCondition

func (s *Statement) SetOrderClauseFromQueryCondition()

Jump to

Keyboard shortcuts

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