velodrome/transform/influx.go
func (config *InfluxConfig) CreateDatabase(tags map[string]string, measurement string) (*InfluxDB, error) {
	client, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{
		Addr:     config.Host,
		Username: config.User,
		Password: config.Password,
	})
	if err != nil {
		return nil, err
	}

	err = dropSeries(client, measurement, config.DB, tags)
	if err != nil {
		return nil, err
	}

	bp, err := influxdb.NewBatchPoints(influxdb.BatchPointsConfig{
		Database:  config.DB,
		Precision: "s",
	})
	if err != nil {
		return nil, err
	}

	return &InfluxDB{
		client:      client,
		database:    config.DB,
		batch:       bp,
		tags:        tags,
		measurement: measurement,
	}, err
}
func (config *InfluxConfig) CreateDatabase(tags map[string]string, measurement string) (*InfluxDB, error) {
	client, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{
		Addr:     config.Host,
		Username: config.User,
		Password: config.Password,
	})
	if err != nil {
		return nil, err
	}

	err = dropSeries(client, measurement, config.DB, tags)
	if err != nil {
		return nil, err
	}

	bp, err := influxdb.NewBatchPoints(influxdb.BatchPointsConfig{
		Database:  config.DB,
		Precision: "s",
	})
	if err != nil {
		return nil, err
	}

	return &InfluxDB{
		client:      client,
		database:    config.DB,
		batch:       bp,
		tags:        tags,
		measurement: measurement,
	}, err
}
func ( config * InfluxConfig ) CreateDatabase ( tags map [ string ] string , measurement string ) ( * InfluxDB , error ) { client , err := influxdb . NewHTTPClient ( influxdb . HTTPConfig { Addr : config . Host , Username : config . User , Password : config . Password , } ) if err != nil { return nil , err } err = dropSeries ( client , measurement , config . DB , tags ) if err != nil { return nil , err } bp , err := influxdb . NewBatchPoints ( influxdb . BatchPointsConfig { Database : config . DB , Precision : " " , } ) if err != nil { return nil , err } return & InfluxDB { client : client , database : config . DB , batch : bp , tags : tags , measurement : measurement , } , err }
// CreateDatabase creates and connects a new instance of an InfluxDB
// It is created based on the fields set in the configuration.
CreateDatabase creates and connects a new instance of an InfluxDB It is created based on the fields set in the configuration .