pgtest

package
v1.38.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectQuery added in v1.2.0

func ExpectQuery(sql string, params [][]byte, oids []uint32) pgmock.Step

Expects a SQL query in any form: simple, prepared, or anonymous.

func ExpectTerminate added in v1.2.0

func ExpectTerminate() pgmock.Step

Types

type MockConn

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

func NewConn

func NewConn() *MockConn

func NewWithStatus

func NewWithStatus(status map[string]string) *MockConn

func (*MockConn) Close

func (r *MockConn) Close(t *testing.T)

func (*MockConn) Intercept

func (r *MockConn) Intercept(config *pgx.ConnConfig)

Configures pgx to use the mock dialer.

The mock dialer provides a full duplex net.Conn backed by an in-memory buffer. It is implemented by grcp/test/bufconn package.

func (*MockConn) Query

func (r *MockConn) Query(sql string, args ...interface{}) *MockConn

Adds a simple query or prepared statement to the mock connection.

func (*MockConn) Reply

func (r *MockConn) Reply(tag string, rows ...[]interface{}) *MockConn

Adds a server reply using text protocol format.

TODO: support binary protocol

func (*MockConn) ReplyError

func (r *MockConn) ReplyError(code, message string) *MockConn

Simulates an error reply from the server.

TODO: simulate a notice reply

Jump to

Keyboard shortcuts

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