testing

package
v5.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAdaptersOpenTestPool = map[string]OpenTestPool{
	"pgx/v4": OpenTestPoolPGXv4,
	"pgx/v5": OpenTestPoolPGXv5,
	"lib/pq": OpenTestPoolLibPQ,
}

AllAdaptersOpenTestPool lists all available adapters with callbacks

Functions

func OpenTestPoolLibPQ

func OpenTestPoolLibPQ(t testing.TB) adapter.ConnPool

OpenTestPoolLibPQ opens connections pool used in testing

func OpenTestPoolLibPQCustomSchemas

func OpenTestPoolLibPQCustomSchemas(t testing.TB, gueSchema, secondSchema string) adapter.ConnPool

OpenTestPoolLibPQCustomSchemas opens connections pool used in testing with gue table installed to own schema and search_path set to two different schemas

func OpenTestPoolMaxConnsLibPQ

func OpenTestPoolMaxConnsLibPQ(t testing.TB, maxConnections int, gueSchema, secondSchema string) adapter.ConnPool

OpenTestPoolMaxConnsLibPQ opens connections pool used in testing

func OpenTestPoolMaxConnsPGXv4

func OpenTestPoolMaxConnsPGXv4(t testing.TB, maxConnections int32) adapter.ConnPool

OpenTestPoolMaxConnsPGXv4 opens connections pool used in testing

func OpenTestPoolMaxConnsPGXv5

func OpenTestPoolMaxConnsPGXv5(t testing.TB, maxConnections int32) adapter.ConnPool

OpenTestPoolMaxConnsPGXv5 opens connections pool used in testing

func OpenTestPoolPGXv4

func OpenTestPoolPGXv4(t testing.TB) adapter.ConnPool

OpenTestPoolPGXv4 opens connections pool used in testing

func OpenTestPoolPGXv5

func OpenTestPoolPGXv5(t testing.TB) adapter.ConnPool

OpenTestPoolPGXv5 opens connections pool used in testing

Types

type CommandTag

type CommandTag struct {
	mock.Mock
}

CommandTag mock implementation of adapter.CommandTag

func (*CommandTag) RowsAffected

func (m *CommandTag) RowsAffected() int64

RowsAffected mock implementation of adapter.CommandTag.RowsAffected()

type Conn

type Conn struct {
	Queryable
	mock.Mock
}

Conn mock implementation of adapter.Conn

func (*Conn) Begin

func (m *Conn) Begin(ctx context.Context) (adapter.Tx, error)

Begin mock implementation of adapter.Conn.Begin()

func (*Conn) Ping

func (m *Conn) Ping(ctx context.Context) error

Ping mock implementation of adapter.Conn.Ping()

func (*Conn) Release

func (m *Conn) Release() error

Release mock implementation of adapter.Conn.Release()

type ConnPool

type ConnPool struct {
	Queryable
	mock.Mock
}

ConnPool mock implementation of adapter.ConnPool

func (*ConnPool) Acquire

func (m *ConnPool) Acquire(ctx context.Context) (adapter.Conn, error)

Acquire mock implementation of adapter.ConnPool.Acquire()

func (*ConnPool) Begin

func (m *ConnPool) Begin(ctx context.Context) (adapter.Tx, error)

Begin mock implementation of adapter.ConnPool.Begin()

func (*ConnPool) Close

func (m *ConnPool) Close() error

Close mock implementation of adapter.ConnPool.Close()

func (*ConnPool) Ping

func (m *ConnPool) Ping(ctx context.Context) error

Ping mock implementation of adapter.ConnPool.Ping()

type OpenOpenTestPoolMaxConns

type OpenOpenTestPoolMaxConns func(t testing.TB, maxConnections int32) adapter.ConnPool

OpenOpenTestPoolMaxConns callback type for opening connection pool with custom max connections used in tests

type OpenTestPool

type OpenTestPool func(t testing.TB) adapter.ConnPool

OpenTestPool callback type for opening connection pool with default parameters used in tests

type Queryable

type Queryable struct {
	mock.Mock
}

Queryable mock implementation of adapter.Queryable

func (*Queryable) Exec

func (m *Queryable) Exec(ctx context.Context, query string, args ...any) (adapter.CommandTag, error)

Exec mock implementation of adapter.Queryable.Exec()

func (*Queryable) Query

func (m *Queryable) Query(ctx context.Context, query string, args ...any) (adapter.Rows, error)

Query mock implementation of adapter.Queryable.Query()

func (*Queryable) QueryRow

func (m *Queryable) QueryRow(ctx context.Context, query string, args ...any) adapter.Row

QueryRow mock implementation of adapter.Queryable.QueryRow()

type Row

type Row struct {
	mock.Mock
}

Row mock implementation of adapter.Row

func (*Row) Scan

func (m *Row) Scan(dest ...any) error

Scan mock implementation of adapter.Row.Scan()

type Rows

type Rows struct {
	mock.Mock
}

Rows mock implementation of adapter.Rows

func (*Rows) Err

func (m *Rows) Err() error

Err mock implementation of adapter.Rows.Err()

func (*Rows) Next

func (m *Rows) Next() bool

Next mock implementation of adapter.Rows.Next()

func (*Rows) Scan

func (m *Rows) Scan(dest ...any) error

Scan mock implementation of adapter.Rows.Scan()

type Tx

type Tx struct {
	Queryable
	mock.Mock
}

Tx mock implementation of adapter.Tx

func (*Tx) Commit

func (m *Tx) Commit(ctx context.Context) error

Commit mock implementation of adapter.Tx.Commit()

func (*Tx) Rollback

func (m *Tx) Rollback(ctx context.Context) error

Rollback mock implementation of adapter.Tx.Rollback()

Jump to

Keyboard shortcuts

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