timescaledb

package
v0.0.0-...-35a3c3a Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDBRunner

func NewDBRunner(dbPool DB) query.Runner

NewDBRunner creates a new TimescaleDB query.Runner

Types

type Benchmarker

type Benchmarker struct {
	benchmark.Benchmarker
	// contains filtered or unexported fields
}

Benchmarker benchmarks TimescaleDB queries.

func NewBenchmarker

func NewBenchmarker(ctx context.Context, c *BenchmarkerConfig, input chan query.Query, output chan query.Result) (*Benchmarker, error)

NewBenchmarker creates a new Benchmarker.

func (*Benchmarker) Start

func (b *Benchmarker) Start(ctx context.Context) error

Start starts the Benchmarker. Implements the run.Startable interface.

func (*Benchmarker) Stop

type BenchmarkerConfig

type BenchmarkerConfig struct {
	// Parsed according to https://github.com/jackc/pgx/blob/master/pgxpool/pool.go#L281-L297 respecting https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
	DBConnectionURI string

	// Num of workers executing queries concurrently
	NumWorkers uint

	// QueryTimeout is the desired max query time. By default, no timeout is applied.
	QueryTimeout time.Duration

	// Debug enables/disables debug mode. Used for printing debug log lines.
	Debug bool

	// OutputFormat is the printing format. [human,csv,markdown], defaults to human.
	OutputFormat OutputFormat
}

BenchmarkerConfig holds the configuration for the Benchmarker.

func (BenchmarkerConfig) Validate

func (c BenchmarkerConfig) Validate() error

Validate validates the config.

type DB

type DB interface {
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error)
}

DB represents a TimescaleDB database. It is based on pgx.Conn and pgxpool.Pool, which is a driver for PostgreSQL.

type OutputFormat

type OutputFormat = string
const (
	FormatHumanReadable OutputFormat = "human"
	FormatCSV           OutputFormat = "csv"
	FormatTSV           OutputFormat = "tsv"
	FormatMarkdown      OutputFormat = "md"
	FormatHTML          OutputFormat = "html"
)

type Query

type Query struct {
	BucketInterval  string // Postgres interval string representation.
	BucketTSColumn  string
	EntityIDValue   string
	EntityIDColumn  string
	BenchmarkColumn string
	Table           string
	PeriodFrom      time.Time
	PeriodTo        time.Time
}

Query represents a query in a TimescaleDB DB.

func (Query) EntityID

func (q Query) EntityID() string

func (Query) String

func (q Query) String() string

String returns a string representation of the Query. It implements fmt.Stringer interface.

Jump to

Keyboard shortcuts

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