timescaledb

package
v0.0.0-...-091dc79 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeValueIdx = "TIME-VALUE"
	ValueTimeIdx = "VALUE-TIME"
)

Variables

This section is empty.

Functions

func MustBegin

func MustBegin(db *sql.DB) *sql.Tx

MustBegin starts transaction or exits on error

func MustConnect

func MustConnect(dbType, connStr string) *sql.DB

MustConnect connects or exits on errors

func MustExec

func MustExec(db *sql.DB, query string, args ...interface{}) sql.Result

MustExec executes query or exits on error

func MustQuery

func MustQuery(db *sql.DB, query string, args ...interface{}) *sql.Rows

MustQuery executes query or exits on error

func NewBenchmark

func NewBenchmark(dbName string, opts *LoadingOptions, dataSourceConfig *source.DataSourceConfig) (targets.Benchmark, error)

func NewTarget

func NewTarget() targets.ImplementedTarget

Types

type LoadingOptions

type LoadingOptions struct {
	PostgresConnect string `yaml:"postgres" mapstructure:"postgres"`
	Host            string `yaml:"host"`
	User            string
	Pass            string
	Port            string
	ConnDB          string `yaml:"admin-db-name" mapstructure:"admin-db-name"`

	UseHypertable bool `yaml:"use-hypertable" mapstructure:"use-hypertable"`
	LogBatches    bool `yaml:"log-batches" mapstructure:"log-batches"`
	UseJSON       bool `yaml:"use-jsonb-tags" mapstructure:"use-jsonb-tags"`
	InTableTag    bool `yaml:"in-table-partition-tag" mapstructure:"in-table-partition-tag"`

	NumberPartitions  int           `yaml:"partitions" mapstructure:"partitions"`
	PartitionColumn   string        `yaml:"partition-column" mapstructure:"partition-column"`
	ReplicationFactor int           `yaml:"replication-factor" mapstructure:"replication-factor"`
	ChunkTime         time.Duration `yaml:"chunk-time" mapstructure:"chunk-time"`

	TimeIndex          bool   `yaml:"time-index" mapstructure:"time-index"`
	TimePartitionIndex bool   `yaml:"time-partition-index" mapstructure:"time-partition-index"`
	PartitionIndex     bool   `yaml:"partition-index" mapstructure:"partition-index"`
	FieldIndex         string `yaml:"field-index" mapstructure:"field-index"`
	FieldIndexCount    int    `yaml:"field-index-count" mapstructure:"field-index-count"`

	ProfileFile          string `yaml:"write-profile" mapstructure:"write-profile"`
	ReplicationStatsFile string `yaml:"write-replication-stats" mapstructure:"write-replication-stats"`

	CreateMetricsTable bool     `yaml:"create-metrics-table" mapstructure:"create-metrics-table"`
	ForceTextFormat    bool     `yaml:"force-text-format" mapstructure:"force-text-format"`
	TagColumnTypes     []string `yaml:",omitempty" mapstructure:",omitempty"`
	UseInsert          bool     `yaml:"use-insert" mapstructure:"use-insert"`
}

Loading option vars:

func (*LoadingOptions) GetConnectString

func (o *LoadingOptions) GetConnectString(dbName string) string

type Serializer

type Serializer struct{}

Serializer writes a Point in a serialized form for TimescaleDB

func (*Serializer) Serialize

func (s *Serializer) Serialize(p *data.Point, w io.Writer) error

Serialize writes Point p to the given Writer w, so it can be loaded by the TimescaleDB loader. The format is CSV with two lines per Point, with the first row being the tags and the second row being the field values.

e.g., tags,<tag1>,<tag2>,<tag3>,... <measurement>,<timestamp>,<field1>,<field2>,<field3>,...

Jump to

Keyboard shortcuts

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