Documentation ¶
Index ¶
- Variables
- type DBMock
- func (m *DBMock) Acquire(ctx context.Context) (*pgxpool.Conn, error)
- func (m *DBMock) Begin(ctx context.Context) (pgx.Tx, error)
- func (m *DBMock) Exec(ctx context.Context, query string, params ...interface{}) (pgconn.CommandTag, error)
- func (m *DBMock) QueryRow(ctx context.Context, query string, params ...interface{}) pgx.Row
- type ErrReader
- type HTTPClientMock
- type RowMock
- type TXMock
- func (m *TXMock) Begin(ctx context.Context) (pgx.Tx, error)
- func (m *TXMock) BeginFunc(ctx context.Context, f func(pgx.Tx) error) error
- func (m *TXMock) Commit(ctx context.Context) error
- func (m *TXMock) Conn() *pgx.Conn
- func (m *TXMock) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, ...) (int64, error)
- func (m *TXMock) Exec(ctx context.Context, query string, params ...interface{}) (pgconn.CommandTag, error)
- func (m *TXMock) LargeObjects() pgx.LargeObjects
- func (m *TXMock) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
- func (m *TXMock) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (m *TXMock) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, ...) (pgconn.CommandTag, error)
- func (m *TXMock) QueryRow(ctx context.Context, query string, params ...interface{}) pgx.Row
- func (m *TXMock) Rollback(ctx context.Context) error
- func (m *TXMock) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Constants ¶
This section is empty.
Variables ¶
var ErrFake = errors.New("fake error for tests")
ErrFake represents a fake error used in tests.
var ErrFakeDB = errors.New("fake database failure")
ErrFakeDB represents a fake database error.
Functions ¶
This section is empty.
Types ¶
type DBMock ¶
DBMock is a mock implementation of the DB interface.
type ErrReader ¶
type ErrReader int
ErrReader represents a faulty reader implementation. It can be handy to simulate faulty requests bodies (ioutil.NopCloser(tests.ErrReader(0))).
type HTTPClientMock ¶
HTTPClientMock is a mock HTTPClient implementation.
type RowMock ¶
type RowMock struct {
// contains filtered or unexported fields
}
RowMock is a mock implementation of the pgx.Row interface.
type TXMock ¶
TXMock is a mock implementation of the pgx.Tx interface.
func (*TXMock) CopyFrom ¶
func (m *TXMock) CopyFrom( ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource, ) (int64, error)
CopyFrom implements the pgx.Tx interface.
func (*TXMock) Exec ¶
func (m *TXMock) Exec(ctx context.Context, query string, params ...interface{}) (pgconn.CommandTag, error)
Exec implements the pgx.Tx interface.
func (*TXMock) LargeObjects ¶
func (m *TXMock) LargeObjects() pgx.LargeObjects
LargeObjects implements the pgx.Tx interface.
func (*TXMock) Prepare ¶
func (m *TXMock) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
Prepare implements the pgx.Tx interface.
func (*TXMock) QueryFunc ¶
func (m *TXMock) QueryFunc( ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error, ) (pgconn.CommandTag, error)
QueryFunc implements the pgx.Tx interface.