influxdb

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Time is InfluxDB time tag
	Time string = "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"`
}

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
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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