database

package
v3.19.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(path string) (sess db.Session, err error)

Connect to the database

func RunMigrations

func RunMigrations(sess *sql.DB) error

RunMigrations runs the database migrations

Types

type Database

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

Database is a database instance to store measurements

func Open

func Open(dbpath string) (*Database, error)

Open returns a new database instance

func (*Database) AddTestKeys

func (d *Database) AddTestKeys(msmt *model.DatabaseMeasurement, tk any) error

AddTestKeys implements WritableDatabase.AddTestKeys

func (*Database) Close

func (d *Database) Close() error

Close implements Writable/ReadableDatabase.Close

func (*Database) CreateMeasurement

func (d *Database) CreateMeasurement(reportID sql.NullString, testName string, measurementDir string, idx int,
	resultID int64, urlID sql.NullInt64) (*model.DatabaseMeasurement, error)

CreateMeasurement implements WritableDatabase.CreateMeasurement

func (*Database) CreateNetwork

func (d *Database) CreateNetwork(loc model.LocationProvider) (*model.DatabaseNetwork, error)

CreateNetwork implements WritableDatabase.CreateNetwork

func (*Database) CreateOrUpdateURL

func (d *Database) CreateOrUpdateURL(urlStr string, categoryCode string, countryCode string) (int64, error)

CreateOrUpdateURL implements WritableDatabase.CreateOrUpdateURL

func (*Database) CreateResult

func (d *Database) CreateResult(homePath string, testGroupName string, networkID int64) (*model.DatabaseResult, error)

CreateResult implements WritableDatabase.CreateResult

func (*Database) DeleteResult

func (d *Database) DeleteResult(resultID int64) error

DeleteResult implements WritableDatabase.DeleteResult

func (*Database) Done

func (d *Database) Done(msmt *model.DatabaseMeasurement) error

Done implements WritableDatabase.Done

func (*Database) Failed

func (d *Database) Failed(msmt *model.DatabaseMeasurement, failure string) error

Failed implements WritableDatabase.Failed

func (*Database) Finished

func (d *Database) Finished(result *model.DatabaseResult) error

Finished implements WritableDatabase.Finished

func (*Database) GetMeasurementJSON

func (d *Database) GetMeasurementJSON(msmtID int64) (map[string]interface{}, error)

GetMeasurementJSON implements ReadableDatabase.GetMeasurementJSON

func (*Database) ListMeasurements

func (d *Database) ListMeasurements(resultID int64) ([]model.DatabaseMeasurementURLNetwork, error)

ListMeasurements implements ReadableDatabase.ListMeasurements

func (*Database) ListResults

ListResults implements ReadableDatabase.ListResults

func (*Database) Session

func (d *Database) Session() db.Session

Session implements Writable/ReadableDatabase.Session

func (*Database) UpdateUploadedStatus

func (d *Database) UpdateUploadedStatus(result *model.DatabaseResult) error

UpdateUploadedStatus implements WritableDatabase.UpdateUploadedStatus

func (*Database) UploadFailed

func (d *Database) UploadFailed(msmt *model.DatabaseMeasurement, failure string) error

UploadFailed implements WritableDatabase.UploadFailed

func (*Database) UploadSucceeded

func (d *Database) UploadSucceeded(msmt *model.DatabaseMeasurement) error

UploadSucceeded implements WritableDatabase.UploadSucceeded

Jump to

Keyboard shortcuts

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