timescaledb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FPTableDaily   = "daily_stats_fp"
	FPTableOverall = "statistics_fp"
)
View Source
const (
	IntTableDaily   = "daily_stats_int"
	IntTableOverall = "statistics_int"
)
View Source
const (
	JSONTableDaily   = "daily_stats_json"
	JSONTableOverall = "statistics_json"
)

Variables

View Source
var DeleteFPByCategoryQuery = "DELETE FROM %s WHERE category=?"
View Source
var DeleteFPByTimeQuery = "SELECT drop_chunks(INTERVAL '?', '%s');"
View Source
var DeleteIntByCategoryQuery = "DELETE FROM %s WHERE category=?"
View Source
var DeleteIntByTimeQuery = "SELECT drop_chunks(INTERVAL '?', '%s');"
View Source
var DeleteJSONByCategoryQuery = "DELETE FROM %s WHERE category=?"
View Source
var DeleteJSONByTimeQuery = "SELECT drop_chunks(INTERVAL '?', '%s');"
View Source
var ErrFailedToAdd = errors.New("Failed to add row")
View Source
var ErrFailedToDelete = errors.New("Failed to delete row")
View Source
var GetFPByCategoryAndTimeQuery = "SELECT * FROM %s WHERE viewer_id = $1 AND created_at > $2"
View Source
var GetIntByCategoryAndTimeQuery = "SELECT * FROM %s WHERE viewer_id = $1 AND created_at > $2"
View Source
var GetJSONByCategoryAndTimeQuery = "SELECT * FROM %s WHERE viewer_id = $1 AND created_at > $2"

Functions

This section is empty.

Types

type TimescaleFunctions

type TimescaleFunctions struct {
	DBConnection       string
	MigrationDirectory string
}

func (*TimescaleFunctions) AddRowFP

func (f *TimescaleFunctions) AddRowFP(table string, data []models.StatsFP) error

func (*TimescaleFunctions) AddRowInt

func (f *TimescaleFunctions) AddRowInt(table string, data []models.StatsInt) error

func (*TimescaleFunctions) AddRowJSON

func (f *TimescaleFunctions) AddRowJSON(table string, data []models.StatsJSON) error

func (*TimescaleFunctions) BootstrapTables

func (c *TimescaleFunctions) BootstrapTables() error

func (*TimescaleFunctions) Commit

func (*TimescaleFunctions) Commit(tx *sql.Tx) error

func (*TimescaleFunctions) Connect

func (c *TimescaleFunctions) Connect() (*sql.Tx, error)

func (*TimescaleFunctions) DeleteFPByCategory

func (f *TimescaleFunctions) DeleteFPByCategory(table string, category int) error

func (*TimescaleFunctions) DeleteFPByTime

func (f *TimescaleFunctions) DeleteFPByTime(table string, intervalString string) error

DeleteFPByTime is handling cleanup delete of old data after it has been backed up. It will delete all data in the table older, than the INTERVAL.

func (*TimescaleFunctions) DeleteIntByCategory

func (f *TimescaleFunctions) DeleteIntByCategory(table string, category int) error

func (*TimescaleFunctions) DeleteIntByTime

func (f *TimescaleFunctions) DeleteIntByTime(table string, intervalString string) error

DeleteIntByTime is handling cleanup delete of old data after it has been backed up. It will delete all data in the table older, than the INTERVAL.

func (*TimescaleFunctions) DeleteJSONByCategory

func (f *TimescaleFunctions) DeleteJSONByCategory(table string, category int) error

func (*TimescaleFunctions) DeleteJSONByTime

func (f *TimescaleFunctions) DeleteJSONByTime(table string, intervalString string) error

DeleteByTime is handling cleanup delete of old data after it has been backed up. It will delete all data in the table older, than the INTERVAL.

func (*TimescaleFunctions) GetFPByCategoryAndTime

func (f *TimescaleFunctions) GetFPByCategoryAndTime(table string, category int, time time.Time) ([]models.StatsFP, error)

GetFPByCategoryAndTime returns a chunk of data belonging to the defined viewer and starting from the defined time.

func (*TimescaleFunctions) GetIntByCategoryAndTime

func (f *TimescaleFunctions) GetIntByCategoryAndTime(table string, category int, time time.Time) ([]models.StatsInt, error)

GetIntByCategoryAndTime returns a chunk of data belonging to the defined viewer and starting from the defined time.

func (*TimescaleFunctions) GetJSONByCategoryAndTime

func (f *TimescaleFunctions) GetJSONByCategoryAndTime(table string, category int, time time.Time) ([]models.StatsJSON, error)

GetDataByViewerAndTime returns a chunk of data belonging to the defined viewer and starting from the defined time.

func (*TimescaleFunctions) Rollback

func (*TimescaleFunctions) Rollback(tx *sql.Tx) error

func (*TimescaleFunctions) RollbackWithErrorStack

func (*TimescaleFunctions) RollbackWithErrorStack(tx *sql.Tx, errorStack error) error

Jump to

Keyboard shortcuts

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