Documentation ¶
Index ¶
- Constants
- Variables
- type TimescaleFunctions
- func (f *TimescaleFunctions) AddRowFP(table string, data []models.StatsFP) error
- func (f *TimescaleFunctions) AddRowInt(table string, data []models.StatsInt) error
- func (f *TimescaleFunctions) AddRowJSON(table string, data []models.StatsJSON) error
- func (c *TimescaleFunctions) BootstrapTables() error
- func (*TimescaleFunctions) Commit(tx *sql.Tx) error
- func (c *TimescaleFunctions) Connect() (*sql.Tx, error)
- func (f *TimescaleFunctions) DeleteFPByCategory(table string, category int) error
- func (f *TimescaleFunctions) DeleteFPByTime(table string, intervalString string) error
- func (f *TimescaleFunctions) DeleteIntByCategory(table string, category int) error
- func (f *TimescaleFunctions) DeleteIntByTime(table string, intervalString string) error
- func (f *TimescaleFunctions) DeleteJSONByCategory(table string, category int) error
- func (f *TimescaleFunctions) DeleteJSONByTime(table string, intervalString string) error
- func (f *TimescaleFunctions) GetFPByCategoryAndTime(table string, category int, time time.Time) ([]models.StatsFP, error)
- func (f *TimescaleFunctions) GetIntByCategoryAndTime(table string, category int, time time.Time) ([]models.StatsInt, error)
- func (f *TimescaleFunctions) GetJSONByCategoryAndTime(table string, category int, time time.Time) ([]models.StatsJSON, error)
- func (*TimescaleFunctions) Rollback(tx *sql.Tx) error
- func (*TimescaleFunctions) RollbackWithErrorStack(tx *sql.Tx, errorStack error) error
Constants ¶
const ( FPTableDaily = "daily_stats_fp" FPTableOverall = "statistics_fp" )
const ( IntTableDaily = "daily_stats_int" IntTableOverall = "statistics_int" )
const ( JSONTableDaily = "daily_stats_json" JSONTableOverall = "statistics_json" )
Variables ¶
var DeleteFPByCategoryQuery = "DELETE FROM %s WHERE category=?"
var DeleteFPByTimeQuery = "SELECT drop_chunks(INTERVAL '?', '%s');"
var DeleteIntByCategoryQuery = "DELETE FROM %s WHERE category=?"
var DeleteIntByTimeQuery = "SELECT drop_chunks(INTERVAL '?', '%s');"
var DeleteJSONByCategoryQuery = "DELETE FROM %s WHERE category=?"
var DeleteJSONByTimeQuery = "SELECT drop_chunks(INTERVAL '?', '%s');"
var ErrFailedToAdd = errors.New("Failed to add row")
var ErrFailedToDelete = errors.New("Failed to delete row")
var GetFPByCategoryAndTimeQuery = "SELECT * FROM %s WHERE viewer_id = $1 AND created_at > $2"
var GetIntByCategoryAndTimeQuery = "SELECT * FROM %s WHERE viewer_id = $1 AND created_at > $2"
var GetJSONByCategoryAndTimeQuery = "SELECT * FROM %s WHERE viewer_id = $1 AND created_at > $2"
Functions ¶
This section is empty.
Types ¶
type TimescaleFunctions ¶
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) 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) RollbackWithErrorStack ¶
func (*TimescaleFunctions) RollbackWithErrorStack(tx *sql.Tx, errorStack error) error