db

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datab added in v0.20.0

type Datab interface {
	Set(models.DBEnvironmentTest, []models.DBTestCase) error

	Initialize() error

	GetEnvironmentTestsAndTestCases() (map[string]interface{}, error)

	GetEnvCharts(string, int) (map[string]interface{}, error)

	GetOverview(dataRange int) (map[string]interface{}, error)

	GetTestCharts(string, string) (map[string]interface{}, error)
}

Datab is the database interface we support

func FromEnv

func FromEnv(fv FlagValues) (c Datab, err error)

FromEnv configures and returns a database instance. backend and path parameters are default config, otherwise gets config from the environment variables DB_BACKEND and DB_PATH

func NewCloudSQL

func NewCloudSQL(cfg config) (Datab, error)

NewCloudSQL returns a new Google Cloud SQL database

type FlagValues added in v0.19.0

type FlagValues struct {
	Backend     string
	Host        string
	Path        string
	UseCloudSQL bool
	UseIAMAuth  bool
}

FlagValues are the config values from flags

type Postgres

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

func (*Postgres) GetEnvCharts added in v0.20.0

func (m *Postgres) GetEnvCharts(env string, testsInTop int) (map[string]interface{}, error)

GetEnvCharts writes the overall environment charts to a map with the keys recentFlakePercentTable, flakeRateByWeek, flakeRateByDay, and countsAndDurations

func (*Postgres) GetEnvironmentTestsAndTestCases added in v0.20.0

func (m *Postgres) GetEnvironmentTestsAndTestCases() (map[string]interface{}, error)

GetEnvironmentTestsAndTestCases writes the database tables to a map with the keys environmentTests and testCases

func (*Postgres) GetOverview added in v0.20.0

func (m *Postgres) GetOverview(dateRange int) (map[string]interface{}, error)

GetOverview writes the overview charts to a map with the keys summaryAvgFail and summaryTable

func (*Postgres) GetTestCharts added in v0.20.0

func (m *Postgres) GetTestCharts(env string, test string) (map[string]interface{}, error)

GetTestCharts writes the individual test chart data to a map with the keys flakeByDay and flakeByWeek

func (*Postgres) Initialize

func (m *Postgres) Initialize() error

Initialize creates the tables within the Postgres database

func (*Postgres) Set

func (m *Postgres) Set(commitRow models.DBEnvironmentTest, dbRows []models.DBTestCase) error

Set adds/updates rows to the database

Jump to

Keyboard shortcuts

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