influxdb

package
v4.2.160+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Time is InfluxDB time tag
	Time string = "time"

	// EndTime is InfluxDB time tag
	EndTime string = "end_time"

	// ClusterStatus is cluster_status database
	ClusterStatus Database = "alameda_cluster_status"

	// Prediction is prediction database
	Prediction Database = "alameda_prediction"

	// Recommendation is recommendation database
	Recommendation Database = "alameda_recommendation"

	// Planning is planning database
	Planning Database = "alameda_planning"

	// Score is score database
	Score Database = "alameda_score"
)

Variables

View Source
var (
	// ZeroTime is used as a constant of timestamp
	ZeroTime time.Time = time.Unix(0, 0)
)

Functions

func CompareRawdataWithInfluxResults added in v0.3.31

func CompareRawdataWithInfluxResults(readRawdata *Common.ReadRawdata, results []InfluxDBClient.Result) error

func InfluxResultToReadRawdata added in v0.3.31

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

func ReadRawdata added in v0.3.31

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

func WriteRawdata added in v0.3.31

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"`
	RetentionDuration      string `mapstructure:"retentionDuration"`
	RetentionShardDuration string `mapstructure:"retentionShardDuration"`
}

func NewDefaultConfig

func NewDefaultConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

type Database

type Database string

type InfluxDBEntity

type InfluxDBEntity struct {
	Time   time.Time
	Tags   map[string]string
	Fields map[string]interface{}
}

type InfluxDBRepository

type InfluxDBRepository struct {
	Address                string
	Username               string
	Password               string
	RetentionDuration      string
	RetentionShardDuration string
}

InfluxDBRepository interacts with database

func New

func New(influxCfg *Config) *InfluxDBRepository

New returns InfluxDBRepository instance

func (*InfluxDBRepository) CreateDatabase

func (influxDBRepository *InfluxDBRepository) CreateDatabase(db string) error

CreateDatabase creates database

func (*InfluxDBRepository) ModifyDefaultRetentionPolicy added in v0.3.8

func (influxDBRepository *InfluxDBRepository) ModifyDefaultRetentionPolicy(db string) error

Modify default retention policy

func (*InfluxDBRepository) QueryDB

func (influxDBRepository *InfluxDBRepository) QueryDB(cmd, database string) (res []client.Result, err error)

QueryDB queries database

func (*InfluxDBRepository) WritePoints

func (influxDBRepository *InfluxDBRepository) WritePoints(points []*client.Point, bpCfg client.BatchPointsConfig) error

WritePoints writes points to database

type InfluxDBRow

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

func NormalizeResult

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

func PackMap

func PackMap(results []client.Result) []*InfluxDBRow

func ReadRawdataToInfluxDBRow added in v0.3.31

func ReadRawdataToInfluxDBRow(readRawdata *Common.ReadRawdata) []*InfluxDBRow

type InfluxStatement added in v0.3.31

type InfluxStatement struct {
	QueryCondition *QueryCondition
	Database       Database
	Measurement    Measurement
	SelectedFields []string
	GroupByTags    []string
	WhereClause    string
	OrderClause    string
	LimitClause    string
}

func NewInfluxStatement added in v0.3.31

func NewInfluxStatement(query *Common.Query) *InfluxStatement

func (*InfluxStatement) AppendTimeConditionIntoWhereClause added in v0.3.31

func (s *InfluxStatement) AppendTimeConditionIntoWhereClause()

func (InfluxStatement) BuildQueryCmd added in v0.3.31

func (s InfluxStatement) BuildQueryCmd() string

func (*InfluxStatement) SetLimitClauseFromQueryCondition added in v0.3.31

func (s *InfluxStatement) SetLimitClauseFromQueryCondition()

func (*InfluxStatement) SetOrderClauseFromQueryCondition added in v0.3.31

func (s *InfluxStatement) SetOrderClauseFromQueryCondition()

type Measurement

type Measurement string

type Order added in v0.3.0

type Order = int

Order Order enumerator

const (
	// Asc Represent ascending order
	Asc Order = 0
	// Desc Represent descending order
	Desc Order = 1
)

type QueryCondition added in v0.3.0

type QueryCondition struct {
	StartTime      *time.Time
	EndTime        *time.Time
	StepTime       *time.Duration
	TimestampOrder Order
	Limit          int
}

QueryCondition Others query condition

type Statement added in v0.3.0

type Statement struct {
	Measurement    Measurement
	SelectedFields []string
	GroupByTags    []string
	WhereClause    string
	OrderClause    string
	LimitClause    string
}

func (*Statement) AppendTimeConditionIntoWhereClause added in v0.3.0

func (s *Statement) AppendTimeConditionIntoWhereClause(queryCondition QueryCondition)

func (Statement) BuildQueryCmd added in v0.3.0

func (s Statement) BuildQueryCmd() string

func (*Statement) SetLimitClauseFromQueryCondition added in v0.3.0

func (s *Statement) SetLimitClauseFromQueryCondition(queryCondition QueryCondition)

func (*Statement) SetOrderClauseFromQueryCondition added in v0.3.0

func (s *Statement) SetOrderClauseFromQueryCondition(queryCondition QueryCondition)

type StatementNew added in v0.3.27

type StatementNew struct {
	Measurement    Measurement
	SelectedFields []string
	GroupByTags    []string
	WhereClause    string

	OrderClause string
	LimitClause string
	StepClause  string

	QueryCondition *datahub_v1alpha1.QueryCondition
}

func (*StatementNew) AppendLimitClauseFromQueryCondition added in v0.3.27

func (s *StatementNew) AppendLimitClauseFromQueryCondition()

func (*StatementNew) AppendOrderClauseFromQueryCondition added in v0.3.27

func (s *StatementNew) AppendOrderClauseFromQueryCondition()

func (*StatementNew) AppendTimeCondition added in v0.3.27

func (s *StatementNew) AppendTimeCondition(operator string, value int64)

func (*StatementNew) AppendTimeConditionFromQueryCondition added in v0.3.27

func (s *StatementNew) AppendTimeConditionFromQueryCondition()

func (*StatementNew) AppendWhereCondition added in v0.3.27

func (s *StatementNew) AppendWhereCondition(key string, operator string, value string)

func (*StatementNew) AppendWhereConditionDirect added in v0.3.27

func (s *StatementNew) AppendWhereConditionDirect(condition string)

func (StatementNew) BuildQueryCmd added in v0.3.27

func (s StatementNew) BuildQueryCmd() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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