txtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertBeginError

func AssertBeginError(
	t *testing.T,
	ctx context.Context,
	beginner tx.Beginner,
	txOpts *sql.TxOptions,
	expectedBeginError error,
)

func AssertSQLTransactionLevel

func AssertSQLTransactionLevel(t *testing.T, exec Executor, expectedIsolationLevel string, readOnly bool)

func AssertTxCommit

func AssertTxCommit(
	t *testing.T,
	beginner tx.Beginner,
	exec Executor,
	tx tx.Tx,
	nonTxExec Executor,
	opts ...Option,
)

func AssertTxRollback

func AssertTxRollback(
	t *testing.T,
	beginner tx.Beginner,
	exec Executor,
	tx tx.Tx,
	nonTxExec Executor,
	opts ...Option,
)

func AssertUserExists

func AssertUserExists(
	t *testing.T,
	exec Executor,
	userID uuid.UUID,
	userAge int,
	opts ...Option,
)

func AssertUserNotFound

func AssertUserNotFound(
	t *testing.T,
	exec Executor,
	userID uuid.UUID,
	opts ...Option,
)

func WithQuestionMarkPlaceholder

func WithQuestionMarkPlaceholder(opts *txTestOptions)

Types

type Executor

type Executor interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

type Option

type Option func(*txTestOptions)

Jump to

Keyboard shortcuts

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