database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknown is raised when trying to operate on
	// an unpicked database.
	ErrUnknown = errors.New("unknown database")

	// ErrInvalidInstance is raised when trying to
	// operate on a non postgresql instance.
	ErrInvalidInstance = errors.New("expected Postgres instance")

	ErrUnexpectedData = errors.New("data should not exists in instance")
)

Functions

This section is empty.

Types

type Postgres

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

Postgres manages instance for kactus Postgres and provides tools to manipulate and asserts on known postgres databases.

func NewPostgres

func NewPostgres(pickerInstance *picker.Picker, databases ...PostgresInfo) *Postgres

NewPostgres initializes a postgres kactus manager for provided postgres database instances. It relies on a singleton pattern so successive call to NewPostgres will return the same instance

func (*Postgres) AssertData

func (pg *Postgres) AssertData(instance string, data *godog.Table) error

AssertData asserts data exists in provided table for known db instance using provided where clauses.

func (*Postgres) AssertDataDoesNotExists

func (pg *Postgres) AssertDataDoesNotExists(instance string, data *godog.Table) error

AssertDataDoesNotExists asserts data does not exists in provided table for known db instance using provided where clauses.

func (Postgres) Debug

func (Postgres) Debug() error

Debug start debug logs. It will be removed when calling Reset.

func (Postgres) DisableDebug

func (Postgres) DisableDebug() error

DisableDebug stops debugging.

func (*Postgres) Reset

func (pg *Postgres) Reset()

Reset resets postgres instance.

func (*Postgres) StoreField

func (pg *Postgres) StoreField(field, instance, table, key string, data *godog.Table) error

StoreField retrieve existing field from postgres table and store them in disposable store under provided key.

type PostgresInfo

type PostgresInfo struct {
	Key string
	DB  *sql.DB
}

PostgresInfo provides a structure to register a new postgres instance to kactus.

Key will be used to to pick instance. `pg.` will be append to provided key when picking.

DB indicates *sql.DB instance to store under proved key.

Jump to

Keyboard shortcuts

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