postgreswrapper

package
v1.1.2-beta Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanUp

func CleanUp(t testing.TB, wrapper Wrapper)

CleanUp cleans up the events table for the given wrapper

func CleanUpBookEvents

func CleanUpBookEvents(wrapper Wrapper, bookID uuid.UUID) (rowsAffected int64, err error)

CleanUpBookEvents executes SQL for benchmark cleanup for the given wrapper

func GetGreatestOccurredAtTimeFromDB

func GetGreatestOccurredAtTimeFromDB(t testing.TB, wrapper Wrapper) time.Time

GetGreatestOccurredAtTimeFromDB gets the maximum occurred_at time from the events table for the given wrapper

func GetLatestBookIDFromDB

func GetLatestBookIDFromDB(t testing.TB, wrapper Wrapper) uuid.UUID

GetLatestBookIDFromDB gets the latest BookID from the events table for the given wrapper

func GuardThatThereAreEnoughFixtureEventsInStore

func GuardThatThereAreEnoughFixtureEventsInStore(wrapper Wrapper, expectedNumEvents int)

GuardThatThereAreEnoughFixtureEventsInStore checks if there are enough fixture events in the store for the given wrapper

func OptimizeDBForWhileBenchmarking

func OptimizeDBForWhileBenchmarking(wrapper Wrapper) error

OptimizeDBForWhileBenchmarking executes SQL for benchmark cleanup for the given wrapper

func TryCreateEventStoreWithTableName

func TryCreateEventStoreWithTableName(t testing.TB, tableName string) error

TryCreateEventStoreWithTableName tries to create an event store with the given table name and returns the error (for testing error cases)

Types

type PGXPoolWrapper

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

PGXPoolWrapper wraps pgxpool-based testing

func (*PGXPoolWrapper) Close

func (e *PGXPoolWrapper) Close()

func (*PGXPoolWrapper) GetEventStore

func (e *PGXPoolWrapper) GetEventStore() postgresengine.EventStore

type SQLDBWrapper

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

SQLDBWrapper wraps sql.DB-based testing

func (*SQLDBWrapper) Close

func (e *SQLDBWrapper) Close()

func (*SQLDBWrapper) GetEventStore

func (e *SQLDBWrapper) GetEventStore() postgresengine.EventStore

type SQLXWrapper

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

SQLXWrapper wraps sqlx.DB-based testing

func (*SQLXWrapper) Close

func (e *SQLXWrapper) Close()

func (*SQLXWrapper) GetEventStore

func (e *SQLXWrapper) GetEventStore() postgresengine.EventStore

type Wrapper

type Wrapper interface {
	GetEventStore() postgresengine.EventStore
	Close()
}

Wrapper interface to abstract over different engine types

func CreateWrapperWithBenchmarkConfig

func CreateWrapperWithBenchmarkConfig(t testing.TB) Wrapper

CreateWrapperWithBenchmarkConfig creates the appropriate wrapper based on the environment variable

func CreateWrapperWithTestConfig

func CreateWrapperWithTestConfig(t testing.TB) Wrapper

CreateWrapperWithTestConfig creates the appropriate wrapper based on the environment variable

Jump to

Keyboard shortcuts

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