Documentation
¶
Overview ¶
Package conn is a generated GoMock package.
Index ¶
- type ConnectionOption
- type ConnectionOptionData
- type ErrRow
- type ErrorWrapper
- func (i *ErrorWrapper) CopyFrom(_ context.Context, _ pgx.Identifier, _ []string, _ pgx.CopyFromSource) (n int64, err error)
- func (i *ErrorWrapper) Exec(_ context.Context, _ string, _ ...any) (tag pgconn.CommandTag, err error)
- func (i *ErrorWrapper) InTransaction() bool
- func (i *ErrorWrapper) LargeObjects() pgx.LargeObjects
- func (i *ErrorWrapper) Query(_ context.Context, _ string, _ ...any) (rows pgx.Rows, err error)
- func (i *ErrorWrapper) QueryRow(_ context.Context, _ string, _ ...any) (row pgx.Row)
- func (i *ErrorWrapper) SendBatch(_ context.Context, _ *pgx.Batch) (res pgx.BatchResults)
- func (i *ErrorWrapper) TransactionOptions() txmgr.Options
- func (i *ErrorWrapper) WithoutTransaction(ctx context.Context) context.Context
- type IConnection
- type MockIConnection
- func (m *MockIConnection) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, ...) (int64, error)
- func (m *MockIConnection) EXPECT() *MockIConnectionMockRecorder
- func (m *MockIConnection) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
- func (m *MockIConnection) InTransaction() bool
- func (m *MockIConnection) LargeObjects() pgx.LargeObjects
- func (m *MockIConnection) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
- func (m *MockIConnection) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
- func (m *MockIConnection) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
- func (m *MockIConnection) TransactionOptions() txmgr.Options
- func (m *MockIConnection) WithoutTransaction(ctx context.Context) context.Context
- type MockIConnectionMockRecorder
- func (mr *MockIConnectionMockRecorder) CopyFrom(ctx, tableName, columnNames, rowSrc any) *gomock.Call
- func (mr *MockIConnectionMockRecorder) Exec(ctx, sql any, arguments ...any) *gomock.Call
- func (mr *MockIConnectionMockRecorder) InTransaction() *gomock.Call
- func (mr *MockIConnectionMockRecorder) LargeObjects() *gomock.Call
- func (mr *MockIConnectionMockRecorder) Query(ctx, sql any, args ...any) *gomock.Call
- func (mr *MockIConnectionMockRecorder) QueryRow(ctx, sql any, args ...any) *gomock.Call
- func (mr *MockIConnectionMockRecorder) SendBatch(ctx, b any) *gomock.Call
- func (mr *MockIConnectionMockRecorder) TransactionOptions() *gomock.Call
- func (mr *MockIConnectionMockRecorder) WithoutTransaction(ctx any) *gomock.Call
- type MockIStartStopConnector
- func (m *MockIStartStopConnector) Connection(ctx context.Context, opt ...ConnectionOption) IConnection
- func (m *MockIStartStopConnector) EXPECT() *MockIStartStopConnectorMockRecorder
- func (m *MockIStartStopConnector) Start(ctx context.Context) error
- func (m *MockIStartStopConnector) Stop(ctx context.Context) error
- type MockIStartStopConnectorMockRecorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOption ¶
type ConnectionOption func(*ConnectionOptionData)
ConnectionOption options for Connection.
func WithLogQueries ¶
func WithLogQueries() ConnectionOption
WithLogQueries enables query logging at the specific GetDB call level.
type ConnectionOptionData ¶
type ConnectionOptionData struct {
LogQueries bool
}
ConnectionOptionData option data for Connection.
type ErrRow ¶
type ErrRow struct {
// contains filtered or unexported fields
}
ErrRow wrapper around pgx.Row that always returns an error.
type ErrorWrapper ¶
type ErrorWrapper struct {
// contains filtered or unexported fields
}
ErrorWrapper implements the IConnection interface with error return.
func NewDatabaseErrorWrapper ¶
func NewDatabaseErrorWrapper(err error) *ErrorWrapper
NewDatabaseErrorWrapper creates a databaseErrorWrapper.
func (*ErrorWrapper) CopyFrom ¶
func (i *ErrorWrapper) CopyFrom(_ context.Context, _ pgx.Identifier, _ []string, _ pgx.CopyFromSource, ) (n int64, err error)
CopyFrom returns an error.
func (*ErrorWrapper) Exec ¶
func (i *ErrorWrapper) Exec(_ context.Context, _ string, _ ...any) (tag pgconn.CommandTag, err error)
Exec returns an error.
func (*ErrorWrapper) InTransaction ¶
func (i *ErrorWrapper) InTransaction() bool
InTransaction always returns false.
func (*ErrorWrapper) LargeObjects ¶
func (i *ErrorWrapper) LargeObjects() pgx.LargeObjects
LargeObjects panics because it needs to return pgx.LargeObjects which contains private fields and has no constructor.
func (*ErrorWrapper) QueryRow ¶
func (i *ErrorWrapper) QueryRow(_ context.Context, _ string, _ ...any) (row pgx.Row)
QueryRow returns an error.
func (*ErrorWrapper) SendBatch ¶
func (i *ErrorWrapper) SendBatch(_ context.Context, _ *pgx.Batch) (res pgx.BatchResults)
SendBatch returns an error.
func (*ErrorWrapper) TransactionOptions ¶
func (i *ErrorWrapper) TransactionOptions() txmgr.Options
TransactionOptions always returns an empty object.
func (*ErrorWrapper) WithoutTransaction ¶
func (i *ErrorWrapper) WithoutTransaction(ctx context.Context) context.Context
WithoutTransaction returns a context without transaction.
type IConnection ¶
type IConnection interface { // Exec executes a query without returning data Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) // Query executes a query and returns the result Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) // QueryRow gets a connection and executes a query that should return no more than one row. // Errors are deferred until the pgx.Row.Scan method is called. // If the query selects no rows, pgx.Row.Scan will return pgx.ErrNoRows. // Otherwise, pgx.Row.Scan scans the first selected row and discards the rest. // The obtained connection is returned to the pool when the pgx.Row.Scan method is called. QueryRow(ctx context.Context, sql string, args ...any) pgx.Row // SendBatch sends a batch of queries for execution, combining all queries into a single batch SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults // CopyFrom implements bulk data insertion into a table CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) // LargeObjects supports working with large objects and is only available // in a transaction (this is a PostgreSQL limitation). // Will panic if used outside a transaction. LargeObjects() pgx.LargeObjects // InTransaction returns true if a transaction has started. InTransaction() bool // TransactionOptions returns transaction options. If no transaction has started, returns false. TransactionOptions() txmgr.Options // WithoutTransaction returns a context without a transaction. WithoutTransaction(ctx context.Context) context.Context }
IConnection includes methods from pgxpool.Pool, pgx.Conn and pgx.Tx + methods for checking transaction state.
type MockIConnection ¶
type MockIConnection struct {
// contains filtered or unexported fields
}
MockIConnection is a mock of IConnection interface.
func NewMockIConnection ¶
func NewMockIConnection(ctrl *gomock.Controller) *MockIConnection
NewMockIConnection creates a new mock instance.
func (*MockIConnection) CopyFrom ¶
func (m *MockIConnection) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
CopyFrom mocks base method.
func (*MockIConnection) EXPECT ¶
func (m *MockIConnection) EXPECT() *MockIConnectionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockIConnection) Exec ¶
func (m *MockIConnection) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
Exec mocks base method.
func (*MockIConnection) InTransaction ¶
func (m *MockIConnection) InTransaction() bool
InTransaction mocks base method.
func (*MockIConnection) LargeObjects ¶
func (m *MockIConnection) LargeObjects() pgx.LargeObjects
LargeObjects mocks base method.
func (*MockIConnection) SendBatch ¶
func (m *MockIConnection) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
SendBatch mocks base method.
func (*MockIConnection) TransactionOptions ¶
func (m *MockIConnection) TransactionOptions() txmgr.Options
TransactionOptions mocks base method.
func (*MockIConnection) WithoutTransaction ¶
func (m *MockIConnection) WithoutTransaction(ctx context.Context) context.Context
WithoutTransaction mocks base method.
type MockIConnectionMockRecorder ¶
type MockIConnectionMockRecorder struct {
// contains filtered or unexported fields
}
MockIConnectionMockRecorder is the mock recorder for MockIConnection.
func (*MockIConnectionMockRecorder) CopyFrom ¶
func (mr *MockIConnectionMockRecorder) CopyFrom(ctx, tableName, columnNames, rowSrc any) *gomock.Call
CopyFrom indicates an expected call of CopyFrom.
func (*MockIConnectionMockRecorder) Exec ¶
func (mr *MockIConnectionMockRecorder) Exec(ctx, sql any, arguments ...any) *gomock.Call
Exec indicates an expected call of Exec.
func (*MockIConnectionMockRecorder) InTransaction ¶
func (mr *MockIConnectionMockRecorder) InTransaction() *gomock.Call
InTransaction indicates an expected call of InTransaction.
func (*MockIConnectionMockRecorder) LargeObjects ¶
func (mr *MockIConnectionMockRecorder) LargeObjects() *gomock.Call
LargeObjects indicates an expected call of LargeObjects.
func (*MockIConnectionMockRecorder) Query ¶
func (mr *MockIConnectionMockRecorder) Query(ctx, sql any, args ...any) *gomock.Call
Query indicates an expected call of Query.
func (*MockIConnectionMockRecorder) QueryRow ¶
func (mr *MockIConnectionMockRecorder) QueryRow(ctx, sql any, args ...any) *gomock.Call
QueryRow indicates an expected call of QueryRow.
func (*MockIConnectionMockRecorder) SendBatch ¶
func (mr *MockIConnectionMockRecorder) SendBatch(ctx, b any) *gomock.Call
SendBatch indicates an expected call of SendBatch.
func (*MockIConnectionMockRecorder) TransactionOptions ¶
func (mr *MockIConnectionMockRecorder) TransactionOptions() *gomock.Call
TransactionOptions indicates an expected call of TransactionOptions.
func (*MockIConnectionMockRecorder) WithoutTransaction ¶
func (mr *MockIConnectionMockRecorder) WithoutTransaction(ctx any) *gomock.Call
WithoutTransaction indicates an expected call of WithoutTransaction.
type MockIStartStopConnector ¶
type MockIStartStopConnector struct {
// contains filtered or unexported fields
}
MockIStartStopConnector is a mock of IStartStopConnector interface.
func NewMockIStartStopConnector ¶
func NewMockIStartStopConnector(ctrl *gomock.Controller) *MockIStartStopConnector
NewMockIStartStopConnector creates a new mock instance.
func (*MockIStartStopConnector) Connection ¶
func (m *MockIStartStopConnector) Connection(ctx context.Context, opt ...ConnectionOption) IConnection
Connection mocks base method.
func (*MockIStartStopConnector) EXPECT ¶
func (m *MockIStartStopConnector) EXPECT() *MockIStartStopConnectorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockIStartStopConnectorMockRecorder ¶
type MockIStartStopConnectorMockRecorder struct {
// contains filtered or unexported fields
}
MockIStartStopConnectorMockRecorder is the mock recorder for MockIStartStopConnector.
func (*MockIStartStopConnectorMockRecorder) Connection ¶
func (mr *MockIStartStopConnectorMockRecorder) Connection(ctx any, opt ...any) *gomock.Call
Connection indicates an expected call of Connection.