Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Database
- type InfluxDBEntity
- type InfluxDBRepository
- func (influxDBRepository *InfluxDBRepository) CreateDatabase(db string) error
- func (influxDBRepository *InfluxDBRepository) ModifyDefaultRetentionPolicy(db string) error
- func (influxDBRepository *InfluxDBRepository) QueryDB(cmd, database string) (res []client.Result, err error)
- func (influxDBRepository *InfluxDBRepository) WritePoints(points []*client.Point, bpCfg client.BatchPointsConfig) error
- type InfluxDBRow
- type Measurement
- type Order
- type QueryCondition
- type Statement
- type StatementNew
- func (s *StatementNew) AppendLimitClauseFromQueryCondition()
- func (s *StatementNew) AppendOrderClauseFromQueryCondition()
- func (s *StatementNew) AppendTimeCondition(operator string, value int64)
- func (s *StatementNew) AppendTimeConditionFromQueryCondition()
- func (s *StatementNew) AppendWhereCondition(key string, operator string, value string)
- func (s *StatementNew) AppendWhereConditionDirect(condition string)
- func (s StatementNew) BuildQueryCmd() string
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" // 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 ¶
This section is empty.
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
type InfluxDBEntity ¶
type InfluxDBRepository ¶
type InfluxDBRepository struct { Address string Username string Password string RetentionDuration string RetentionShardDuration string }
InfluxDBRepository interacts with database
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
type Measurement ¶
type Measurement string
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 (*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
Click to show internal directories.
Click to hide internal directories.