store

package
v0.0.0-...-6000f1d Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatasetsStore

type DatasetsStore interface {
	GetDatasetByNodeId(ctx context.Context, dsNodeId string) (*pgdb.Dataset, error)
	GetTrashcanRootPaginated(ctx context.Context, datasetId int64, limit int, offset int) (*PackagePage, error)
	GetTrashcanPaginated(ctx context.Context, datasetId int64, parentId int64, limit int, offset int) (*PackagePage, error)
	CountDatasetPackagesByStates(ctx context.Context, datasetId int64, states []packageState.State) (int, error)
	GetDatasetPackageByNodeId(ctx context.Context, datasetId int64, packageNodeId string) (*pgdb.Package, error)
}

type DatasetsStoreFactory

type DatasetsStoreFactory interface {
	NewSimpleStore(orgId int) DatasetsStore
	ExecStoreTx(ctx context.Context, orgId int, fn func(store DatasetsStore) error) error
}

func NewDatasetsStoreFactory

func NewDatasetsStoreFactory(pennsieveDB *sql.DB) DatasetsStoreFactory

type PackagePage

type PackagePage struct {
	TotalCount int
	Packages   []pgdb.Package
}

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	SSLMode  string
}

func PostgresConfigFromEnv

func PostgresConfigFromEnv() *PostgresConfig

func (*PostgresConfig) LogString

func (c *PostgresConfig) LogString() string

func (*PostgresConfig) Open

func (c *PostgresConfig) Open() (*sql.DB, error)

func (*PostgresConfig) OpenAtSchema

func (c *PostgresConfig) OpenAtSchema(schema string) (*sql.DB, error)

func (*PostgresConfig) String

func (c *PostgresConfig) String() string

type Queries

type Queries struct {
	OrgId int
	// contains filtered or unexported fields
}

func NewQueries

func NewQueries(db pg.DBTX, orgId int) *Queries

func (*Queries) CountDatasetPackagesByStates

func (q *Queries) CountDatasetPackagesByStates(ctx context.Context, datasetId int64, states []packageState.State) (int, error)

func (*Queries) GetDatasetByNodeId

func (q *Queries) GetDatasetByNodeId(ctx context.Context, dsNodeId string) (*pgdb.Dataset, error)

func (*Queries) GetDatasetPackageByNodeId

func (q *Queries) GetDatasetPackageByNodeId(ctx context.Context, datasetId int64, packageNodeId string) (*pgdb.Package, error)

func (*Queries) GetTrashcanPaginated

func (q *Queries) GetTrashcanPaginated(ctx context.Context, datasetId int64, parentId int64, limit int, offset int) (*PackagePage, error)

func (*Queries) GetTrashcanRootPaginated

func (q *Queries) GetTrashcanRootPaginated(ctx context.Context, datasetId int64, limit int, offset int) (*PackagePage, error)

type TestDB

type TestDB struct {
	*sql.DB
	// contains filtered or unexported fields
}

func OpenDB

func OpenDB(t *testing.T) TestDB

func (*TestDB) Close

func (tdb *TestDB) Close()

func (*TestDB) CloseRows

func (tdb *TestDB) CloseRows(rows *sql.Rows)

func (*TestDB) ExecSQLFile

func (tdb *TestDB) ExecSQLFile(sqlFile string)

func (*TestDB) PingUntilReady

func (tdb *TestDB) PingUntilReady() error

PingUntilReady pings the db up to 10 times, stopping when a ping is successful. Used because there have been problems on Jenkins with the test DB not being fully started and ready to make connections. But there must be a better way.

func (*TestDB) Queries

func (tdb *TestDB) Queries(orgId int) *Queries

func (*TestDB) Truncate

func (tdb *TestDB) Truncate(orgID int, table string)

func (*TestDB) TruncatePennsieve

func (tdb *TestDB) TruncatePennsieve(table string)

Jump to

Keyboard shortcuts

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