db

package
v0.1.0-rc.6 Latest Latest
Warning

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

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

Documentation

Overview

Package db creates DB tables, call resource manager interfaces and populates the DB with compute units

Index

Constants

This section is empty.

Variables

View Source
var MigrationsFS embed.FS

Functions

func NewStatsDB

func NewStatsDB(c *Config) (*statsDB, error)

NewStatsDB returns a new instance of statsDB struct

Types

type Config

type Config struct {
	Logger               log.Logger
	DataPath             string
	DataBackupPath       string
	RetentionPeriod      time.Duration
	SkipDeleteOldUnits   bool
	LastUpdateTimeString string
	ResourceManager      func(log.Logger) (*resource.Manager, error)
	Updater              func(log.Logger) (*updater.UnitUpdater, error)
	TSDB                 *tsdb.TSDB
}

Config makes a DB config from CLI args

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator implements DB migrations

func NewMigrator

func NewMigrator(sqlFiles embed.FS, dirName string, logger log.Logger) (*Migrator, error)

NewMigrator returns new instance of Migrator

func (*Migrator) ApplyMigrations

func (m *Migrator) ApplyMigrations(db *sql.DB) error

ApplyMigrations applies DB migrations

Jump to

Keyboard shortcuts

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