Versions in this module Expand all Collapse all v1 v1.8.0 May 8, 2025 Changes in this version + func CreateHypertable(ctx context.Context, db *DB, table, timeColumn string, ...) error + func IsTimescaleDB(config db.Config) bool + type AggregateFunction string + const AggrAvg + const AggrCount + const AggrFirst + const AggrLast + const AggrMax + const AggrMin + const AggrSum + type ColumnAggregation struct + Alias string + Column string + Function AggregateFunction + type ColumnMetadata struct + Description string + IsIndexed bool + IsPrimaryKey bool + Name string + Nullable bool + Type string + type CompressionPolicy struct + After string + CompressChunk bool + Enabled bool + OrderBy string + SegmentBy string + type CompressionSettings struct + ChunkTimeInterval string + CompressionEnabled bool + CompressionInterval string + HypertableName string + OrderBy string + SegmentBy string + type ContinuousAggregateMetadata struct + HypertableName string + HypertableSchema string + MaterializedOnly bool + RefreshEndOffset string + RefreshInterval string + RefreshLag string + RefreshStartOffset string + ViewDefinition string + ViewName string + ViewSchema string + type ContinuousAggregateOptions struct + Aggregations []ColumnAggregation + BucketInterval string + CreateIfNotExists bool + MaterializedOnly bool + RefreshInterval string + RefreshLookback string + RefreshPolicy bool + SourceTable string + TimeColumn string + ViewName string + WhereCondition string + WithData bool + type ContinuousAggregatePolicyOptions struct + End string + ScheduleInterval string + Start string + ViewName string + type DB struct + func NewTimescaleDB(config DBConfig) (*DB, error) + func (t *DB) AddCompressionPolicy(ctx context.Context, tableName, interval, segmentBy, orderBy string) error + func (t *DB) AddContinuousAggregatePolicy(ctx context.Context, options ContinuousAggregatePolicyOptions) error + func (t *DB) AddDimension(ctx context.Context, tableName, columnName string, numPartitions int) error + func (t *DB) AddRetentionPolicy(ctx context.Context, tableName, interval string) error + func (t *DB) AnalyzeTimeSeries(ctx context.Context, table, timeColumn string, startTime, endTime time.Time) (map[string]interface{}, error) + func (t *DB) ApplyConfig() error + func (t *DB) CheckIfHypertable(ctx context.Context, tableName string) (bool, error) + func (t *DB) Close() error + func (t *DB) CompressChunks(ctx context.Context, tableName, olderThan string) error + func (t *DB) Connect() error + func (t *DB) CreateContinuousAggregate(ctx context.Context, options ContinuousAggregateOptions) error + func (t *DB) CreateHypertable(ctx context.Context, config HypertableConfig) error + func (t *DB) DecompressChunks(ctx context.Context, tableName, newerThan string) error + func (t *DB) DetectTimescaleDBVersion(ctx context.Context) (string, error) + func (t *DB) DisableCompression(ctx context.Context, tableName string) error + func (t *DB) DownsampleTimeSeries(ctx context.Context, options DownsampleOptions) error + func (t *DB) DropContinuousAggregate(ctx context.Context, viewName string, cascade bool) error + func (t *DB) DropHypertable(ctx context.Context, tableName string, cascade bool) error + func (t *DB) EnableCompression(ctx context.Context, tableName string, afterInterval string) error + func (t *DB) ExecuteSQL(ctx context.Context, query string, args ...interface{}) (interface{}, error) + func (t *DB) ExecuteSQLWithoutParams(ctx context.Context, query string) (interface{}, error) + func (t *DB) ExtVersion() string + func (t *DB) GenerateHypertableSchema(ctx context.Context, tableName string) (string, error) + func (t *DB) GetChunkCompressionStats(ctx context.Context, tableName string) (interface{}, error) + func (t *DB) GetCommonTimeIntervals() []string + func (t *DB) GetCompressionSettings(ctx context.Context, tableName string) (*CompressionSettings, error) + func (t *DB) GetContinuousAggregate(ctx context.Context, viewName string) (*ContinuousAggregateMetadata, error) + func (t *DB) GetContinuousAggregateInfo(ctx context.Context, viewName string) (map[string]interface{}, error) + func (t *DB) GetDatabaseSize(ctx context.Context) (map[string]string, error) + func (t *DB) GetHypertable(ctx context.Context, tableName string) (*Hypertable, error) + func (t *DB) GetHypertableMetadata(ctx context.Context, tableName string) (*HypertableMetadata, error) + func (t *DB) GetRetentionSettings(ctx context.Context, tableName string) (*RetentionSettings, error) + func (t *DB) GetTableColumns(ctx context.Context, tableName string) ([]ColumnMetadata, error) + func (t *DB) IsTimescaleDB() bool + func (t *DB) ListContinuousAggregates(ctx context.Context) ([]ContinuousAggregateMetadata, error) + func (t *DB) ListHypertables(ctx context.Context) ([]Hypertable, error) + func (t *DB) RecentChunks(ctx context.Context, tableName string, limit int) (interface{}, error) + func (t *DB) RefreshContinuousAggregate(ctx context.Context, viewName, startTime, endTime string) error + func (t *DB) RemoveCompressionPolicy(ctx context.Context, tableName string) error + func (t *DB) RemoveContinuousAggregatePolicy(ctx context.Context, viewName string) error + func (t *DB) RemoveRetentionPolicy(ctx context.Context, tableName string) error + func (t *DB) TimeSeriesQuery(ctx context.Context, options TimeSeriesQueryOptions) ([]map[string]interface{}, error) + type DBConfig struct + ChunkTimeInterval string + CompressionPolicy *CompressionPolicy + PostgresConfig db.Config + RetentionPolicy *RetentionPolicy + UseTimescaleDB bool + func FromDBConfig(config db.Config) DBConfig + func NewDefaultTimescaleDBConfig(pgConfig db.Config) DBConfig + type DownsampleOptions struct + Aggregations []ColumnAggregation + BucketInterval string + ChunkTimeInterval string + CreateTable bool + DestTable string + SourceTable string + TimeColumn string + WhereCondition string + type Hypertable struct + CompressionEnabled bool + NumDimensions int + RetentionEnabled bool + SchemaName string + SpaceColumn string + TableName string + TimeColumn string + type HypertableConfig struct + ChunkTimeInterval string + CreateIfNotExists bool + IfNotExists bool + MigrateData bool + PartitioningColumn string + SpacePartitions int + TableName string + TimeColumn string + type HypertableMetadata struct + ChunkTimeInterval string + Chunks int + Compression bool + NumDimensions int + Owner string + RetentionPolicy bool + SchemaName string + SpaceDimensions []string + TableName string + TimeDimension string + TimeDimensionType string + TotalRows int64 + TotalSize string + type HypertableOption func(*HypertableConfig) + func WithChunkInterval(interval string) HypertableOption + func WithIfNotExists(ifNotExists bool) HypertableOption + func WithMigrateData(migrateData bool) HypertableOption + func WithPartitioningColumn(column string) HypertableOption + type RetentionPolicy struct + DropChunks bool + Duration string + Enabled bool + type RetentionSettings struct + HypertableName string + RetentionEnabled bool + RetentionInterval string + type TimeBucket struct + Alias string + Column string + Interval string + type TimeRange struct + End time.Time + Start time.Time + func PredefinedTimeRange(name string) (*TimeRange, error) + type TimeSeriesQueryOptions struct + Aggregations []ColumnAggregation + BucketColumnName string + BucketInterval string + EndTime time.Time + GroupByColumns []string + Limit int + Offset int + OrderBy string + SelectColumns []string + StartTime time.Time + Table string + TimeColumn string + WhereCondition string + WindowFunctions []WindowFunction + type TimeseriesQueryBuilder struct + func NewTimeseriesQueryBuilder(table string) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) Aggregate(function AggregateFunction, column, alias string) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) Build() (string, []interface{}) + func (b *TimeseriesQueryBuilder) Execute(ctx context.Context, db *DB) ([]map[string]interface{}, error) + func (b *TimeseriesQueryBuilder) GroupBy(cols ...string) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) Limit(limit int) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) Offset(offset int) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) OrderBy(cols ...string) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) Select(cols ...string) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) Where(clause string, args ...interface{}) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) WhereTimeRange(column string, start, end time.Time) *TimeseriesQueryBuilder + func (b *TimeseriesQueryBuilder) WithTimeBucket(interval, column, alias string) *TimeseriesQueryBuilder + type WindowFunction struct + Alias string + Expression string + Frame string + Function string + OrderBy string + PartitionBy string