Documentation
¶
Index ¶
- func MockPgxCollectableRowMethods(m *MockPgxCollectableRow, values []any, t *testing.T)
- func MockScan(mockPgxRow *MockPgxRow, values []any, t *testing.T)
- type CollectRows
- type Connection
- type MockPgxCollectableRow
- type MockPgxRow
- type MockPgxRows
- func (m *MockPgxRows) Close()
- func (m *MockPgxRows) CommandTag() pgconn.CommandTag
- func (m *MockPgxRows) Conn() *pgx.Conn
- func (m *MockPgxRows) Err() error
- func (m *MockPgxRows) FieldDescriptions() []pgconn.FieldDescription
- func (m *MockPgxRows) Next() bool
- func (m *MockPgxRows) RawValues() [][]byte
- func (m *MockPgxRows) Scan(dest ...any) error
- func (m *MockPgxRows) Values() ([]any, error)
- type MockPgxTx
- func (t *MockPgxTx) Begin(ctx context.Context) (pgx.Tx, error)
- func (t *MockPgxTx) Commit(ctx context.Context) error
- func (t *MockPgxTx) Conn() *pgx.Conn
- func (t *MockPgxTx) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, ...) (int64, error)
- func (t *MockPgxTx) Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error)
- func (t *MockPgxTx) LargeObjects() pgx.LargeObjects
- func (t *MockPgxTx) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
- func (t *MockPgxTx) Query(ctx context.Context, sql string, arguments ...any) (pgx.Rows, error)
- func (t *MockPgxTx) QueryRow(ctx context.Context, sql string, arguments ...any) pgx.Row
- func (t *MockPgxTx) Rollback(ctx context.Context) error
- func (t *MockPgxTx) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
- type MockPostgresConnection
- func (m *MockPostgresConnection) Begin(ctx context.Context) (pgx.Tx, error)
- func (m *MockPostgresConnection) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
- func (m *MockPostgresConnection) Query(ctx context.Context, sql string, arguments ...any) (pgx.Rows, error)
- func (m *MockPostgresConnection) QueryRow(ctx context.Context, sql string, arguments ...any) pgx.Row
- type Postgres
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockPgxCollectableRowMethods ¶
func MockPgxCollectableRowMethods(m *MockPgxCollectableRow, values []any, t *testing.T)
MockPgxCollectableRowMethods mocks all the methods of a MockPgxCollectableRow
Types ¶
type CollectRows ¶
CollectRows is a wrapper created to be able to mock pgx.CollectRows function
func MakeCollectRows ¶
func MakeCollectRows[T any](fn pgx.RowToFunc[T]) CollectRows[T]
MakeCollectRows creates a new CollectRows
func MockCollectRows ¶
func MockCollectRows[T any](slice []T, err error) CollectRows[T]
MockCollectRows mocks CollectRows function
type Connection ¶
type Connection interface {
Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
Begin(ctx context.Context) (pgx.Tx, error)
}
Connection is an interface created as an abstraction of pgxpool.Pool to be able to mock it
type MockPgxCollectableRow ¶
MockPgxCollectableRow mock implementation of pgx.CollectableRow
func (*MockPgxCollectableRow) FieldDescriptions ¶
func (m *MockPgxCollectableRow) FieldDescriptions() []pgconn.FieldDescription
func (*MockPgxCollectableRow) RawValues ¶
func (m *MockPgxCollectableRow) RawValues() [][]byte
func (*MockPgxCollectableRow) Scan ¶
func (m *MockPgxCollectableRow) Scan(dest ...any) error
func (*MockPgxCollectableRow) Values ¶
func (m *MockPgxCollectableRow) Values() ([]any, error)
type MockPgxRow ¶
MockPgxRow mock implementation of pgx.Row
func (*MockPgxRow) Scan ¶
func (m *MockPgxRow) Scan(dest ...any) error
type MockPgxRows ¶
MockPgxRows mock implementation of pgx.Rows
func (*MockPgxRows) Close ¶
func (m *MockPgxRows) Close()
func (*MockPgxRows) CommandTag ¶
func (m *MockPgxRows) CommandTag() pgconn.CommandTag
func (*MockPgxRows) Conn ¶
func (m *MockPgxRows) Conn() *pgx.Conn
func (*MockPgxRows) Err ¶
func (m *MockPgxRows) Err() error
func (*MockPgxRows) FieldDescriptions ¶
func (m *MockPgxRows) FieldDescriptions() []pgconn.FieldDescription
func (*MockPgxRows) Next ¶
func (m *MockPgxRows) Next() bool
func (*MockPgxRows) RawValues ¶
func (m *MockPgxRows) RawValues() [][]byte
func (*MockPgxRows) Scan ¶
func (m *MockPgxRows) Scan(dest ...any) error
func (*MockPgxRows) Values ¶
func (m *MockPgxRows) Values() ([]any, error)
type MockPgxTx ¶
MockPgxTx mock implementation of pgx.Tx
func (*MockPgxTx) CopyFrom ¶
func (t *MockPgxTx) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
func (*MockPgxTx) LargeObjects ¶
func (t *MockPgxTx) LargeObjects() pgx.LargeObjects
type MockPostgresConnection ¶
MockPostgresConnection mock implementation of the postgres db
func (*MockPostgresConnection) Exec ¶
func (m *MockPostgresConnection) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres is the representation of a postgres database connection
func InitPostgres ¶
InitPostgres creates a new postgres instance