storage

package
v0.0.0-...-d2cf98a Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaterializedViews = []*MaterializedView{
		{
			Name:              "fieldkit.sensor_data_10m",
			ShortName:         "10m",
			BucketWidth:       time.Minute * 10,
			EndOffsetSQL:      "20 minutes",
			EndOffsetDuration: time.Minute * 20,
		},
		{
			Name:              "fieldkit.sensor_data_1h",
			ShortName:         "1h",
			BucketWidth:       time.Hour * 1,
			EndOffsetSQL:      "3 hours",
			EndOffsetDuration: time.Hour * 3,
		},
		{
			Name:              "fieldkit.sensor_data_6h",
			ShortName:         "6h",
			BucketWidth:       time.Hour * 6,
			EndOffsetSQL:      "21 hours",
			EndOffsetDuration: time.Hour * 21,
		},
		{
			Name:              "fieldkit.sensor_data_24h",
			ShortName:         "24h",
			BucketWidth:       time.Hour * 24,
			EndOffsetSQL:      "72 hours",
			EndOffsetDuration: time.Hour * 72,
		},
	}
)

Functions

func Logger

func Logger(ctx context.Context) *zap.Logger

Types

type MaterializedView

type MaterializedView struct {
	Name              string
	ShortName         string
	BucketWidth       time.Duration
	EndOffsetSQL      string
	EndOffsetDuration time.Duration
}

func (*MaterializedView) HorizonTime

func (mv *MaterializedView) HorizonTime(now time.Time) time.Time

func (*MaterializedView) MakeRefreshAllSQL

func (mv *MaterializedView) MakeRefreshAllSQL() (string, []interface{}, error)

func (*MaterializedView) MakeRefreshWindowSQL

func (mv *MaterializedView) MakeRefreshWindowSQL(start time.Time, end time.Time) (string, []interface{}, error)

func (*MaterializedView) TimeBucket

func (mv *MaterializedView) TimeBucket(original time.Time) time.Time

type TimeScaleDBConfig

type TimeScaleDBConfig struct {
	Url string
	// contains filtered or unexported fields
}

func (*TimeScaleDBConfig) Acquire

func (tsc *TimeScaleDBConfig) Acquire(ctx context.Context) (*pgxpool.Pool, error)

func (*TimeScaleDBConfig) MaterializedViews

func (tsc *TimeScaleDBConfig) MaterializedViews() []*MaterializedView

func (*TimeScaleDBConfig) RefreshViews

func (tsc *TimeScaleDBConfig) RefreshViews(ctx context.Context) error

Jump to

Keyboard shortcuts

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