pgtest

package
v0.0.0-...-b14404a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BunDB

func BunDB(t *testing.T) *bun.DB

func BunTx

func BunTx(t *testing.T) *bun.DB

func DB

func DB(t *testing.T) *sql.DB

DB returns a non-transaction *sql.DB. The reason is there is a need for testing stuff that should not be in the same transactions, e.g. when generating current_timestamp, or locking in different connection.

func DSN

func DSN() string

func InitDB

func InitDB(opts ...Option) func()

func Tx

func Tx(t *testing.T) *sql.DB

Tx runs everything as a single transaction. The operations will be rollbacked at the end, reducing the need to manually create transactions and rollbacking.

Types

type Hook

type Hook func(*sql.DB) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

type Tag

type Tag string

Jump to

Keyboard shortcuts

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