Documentation ¶
Overview ¶
Package pgxpoolmock is a generated GoMock package.
Index ¶
- Variables
- type MockPgxPool
- func (m *MockPgxPool) Acquire(arg0 context.Context) (*pgxpool.Conn, error)
- func (m *MockPgxPool) AcquireAllIdle(arg0 context.Context) []*pgxpool.Conn
- func (m *MockPgxPool) AcquireFunc(arg0 context.Context, arg1 func(*pgxpool.Conn) error) error
- func (m *MockPgxPool) Begin(arg0 context.Context) (pgx.Tx, error)
- func (m *MockPgxPool) BeginFunc(arg0 context.Context, arg1 func(pgx.Tx) error) error
- func (m *MockPgxPool) BeginTx(arg0 context.Context, arg1 pgx.TxOptions) (pgx.Tx, error)
- func (m *MockPgxPool) BeginTxFunc(arg0 context.Context, arg1 pgx.TxOptions, arg2 func(pgx.Tx) error) error
- func (m *MockPgxPool) Close()
- func (m *MockPgxPool) Config() *pgxpool.Config
- func (m *MockPgxPool) CopyFrom(arg0 context.Context, arg1 pgx.Identifier, arg2 []string, ...) (int64, error)
- func (m *MockPgxPool) EXPECT() *MockPgxPoolMockRecorder
- func (m *MockPgxPool) Exec(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgconn.CommandTag, error)
- func (m *MockPgxPool) Ping(arg0 context.Context) error
- func (m *MockPgxPool) Query(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgx.Rows, error)
- func (m *MockPgxPool) QueryRow(arg0 context.Context, arg1 string, arg2 ...interface{}) pgx.Row
- func (m *MockPgxPool) Reset()
- func (m *MockPgxPool) SendBatch(arg0 context.Context, arg1 *pgx.Batch) pgx.BatchResults
- func (m *MockPgxPool) Stat() *pgxpool.Stat
- type MockPgxPoolMockRecorder
- func (mr *MockPgxPoolMockRecorder) Acquire(arg0 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) AcquireAllIdle(arg0 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) AcquireFunc(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Begin(arg0 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) BeginFunc(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) BeginTx(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) BeginTxFunc(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Close() *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Config() *gomock.Call
- func (mr *MockPgxPoolMockRecorder) CopyFrom(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Exec(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Ping(arg0 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Query(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) QueryRow(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Reset() *gomock.Call
- func (mr *MockPgxPoolMockRecorder) SendBatch(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockPgxPoolMockRecorder) Stat() *gomock.Call
- type MockPgxTx
- func (m *MockPgxTx) Begin(arg0 context.Context) (pgx.Tx, error)
- func (m *MockPgxTx) Commit(arg0 context.Context) error
- func (m *MockPgxTx) Conn() *pgx.Conn
- func (m *MockPgxTx) CopyFrom(arg0 context.Context, arg1 pgx.Identifier, arg2 []string, ...) (int64, error)
- func (m *MockPgxTx) EXPECT() *MockPgxTxMockRecorder
- func (m *MockPgxTx) Exec(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgconn.CommandTag, error)
- func (m *MockPgxTx) LargeObjects() pgx.LargeObjects
- func (m *MockPgxTx) Prepare(arg0 context.Context, arg1 string, arg2 string) (*pgconn.StatementDescription, error)
- func (m *MockPgxTx) Query(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgx.Rows, error)
- func (m *MockPgxTx) QueryRow(arg0 context.Context, arg1 string, arg2 ...interface{}) pgx.Row
- func (m *MockPgxTx) Rollback(arg0 context.Context) error
- func (m *MockPgxTx) SendBatch(arg0 context.Context, arg1 *pgx.Batch) pgx.BatchResults
- type MockPgxTxMockRecorder
- func (mr *MockPgxTxMockRecorder) Begin(ctx interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) Commit(ctx interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) Conn() *gomock.Call
- func (mr *MockPgxTxMockRecorder) CopyFrom(ctx, tableName, columnNames, rowSrc interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) Exec(ctx, sql, arguments interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) LargeObjects() *gomock.Call
- func (mr *MockPgxTxMockRecorder) Prepare(ctx, name, sql interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) Query(ctx, sql, args interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) QueryRow(ctx, sql, args interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) Rollback(ctx interface{}) *gomock.Call
- func (mr *MockPgxTxMockRecorder) SendBatch(ctx, b interface{}) *gomock.Call
- type PgxPool
- type Row
- type Rows
Constants ¶
This section is empty.
Variables ¶
var CSVColumnParser = func(s string) interface{} { switch { case strings.ToLower(s) == "null": return nil } return s }
CSVColumnParser is a function which converts trimmed csv column string to a []byte representation. Currently transforms NULL to nil
Functions ¶
This section is empty.
Types ¶
type MockPgxPool ¶
type MockPgxPool struct {
// contains filtered or unexported fields
}
MockPgxPool is a mock of PgxPool interface.
func NewMockPgxPool ¶
func NewMockPgxPool(ctrl *gomock.Controller) *MockPgxPool
NewMockPgxPool creates a new mock instance.
func (*MockPgxPool) AcquireAllIdle ¶
func (m *MockPgxPool) AcquireAllIdle(arg0 context.Context) []*pgxpool.Conn
AcquireAllIdle mocks base method.
func (*MockPgxPool) AcquireFunc ¶
AcquireFunc mocks base method.
func (*MockPgxPool) BeginTxFunc ¶
func (m *MockPgxPool) BeginTxFunc(arg0 context.Context, arg1 pgx.TxOptions, arg2 func(pgx.Tx) error) error
BeginTxFunc mocks base method.
func (*MockPgxPool) Config ¶
func (m *MockPgxPool) Config() *pgxpool.Config
Config mocks base method.
func (*MockPgxPool) CopyFrom ¶
func (m *MockPgxPool) CopyFrom(arg0 context.Context, arg1 pgx.Identifier, arg2 []string, arg3 pgx.CopyFromSource) (int64, error)
CopyFrom mocks base method.
func (*MockPgxPool) EXPECT ¶
func (m *MockPgxPool) EXPECT() *MockPgxPoolMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPgxPool) Exec ¶
func (m *MockPgxPool) Exec(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgconn.CommandTag, error)
Exec mocks base method.
func (*MockPgxPool) Ping ¶
func (m *MockPgxPool) Ping(arg0 context.Context) error
Ping mocks base method.
func (*MockPgxPool) Query ¶
func (m *MockPgxPool) Query(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgx.Rows, error)
Query mocks base method.
func (*MockPgxPool) SendBatch ¶
func (m *MockPgxPool) SendBatch(arg0 context.Context, arg1 *pgx.Batch) pgx.BatchResults
SendBatch mocks base method.
type MockPgxPoolMockRecorder ¶
type MockPgxPoolMockRecorder struct {
// contains filtered or unexported fields
}
MockPgxPoolMockRecorder is the mock recorder for MockPgxPool.
func (*MockPgxPoolMockRecorder) Acquire ¶
func (mr *MockPgxPoolMockRecorder) Acquire(arg0 interface{}) *gomock.Call
Acquire indicates an expected call of Acquire.
func (*MockPgxPoolMockRecorder) AcquireAllIdle ¶
func (mr *MockPgxPoolMockRecorder) AcquireAllIdle(arg0 interface{}) *gomock.Call
AcquireAllIdle indicates an expected call of AcquireAllIdle.
func (*MockPgxPoolMockRecorder) AcquireFunc ¶
func (mr *MockPgxPoolMockRecorder) AcquireFunc(arg0, arg1 interface{}) *gomock.Call
AcquireFunc indicates an expected call of AcquireFunc.
func (*MockPgxPoolMockRecorder) Begin ¶
func (mr *MockPgxPoolMockRecorder) Begin(arg0 interface{}) *gomock.Call
Begin indicates an expected call of Begin.
func (*MockPgxPoolMockRecorder) BeginFunc ¶
func (mr *MockPgxPoolMockRecorder) BeginFunc(arg0, arg1 interface{}) *gomock.Call
BeginFunc indicates an expected call of BeginFunc.
func (*MockPgxPoolMockRecorder) BeginTx ¶
func (mr *MockPgxPoolMockRecorder) BeginTx(arg0, arg1 interface{}) *gomock.Call
BeginTx indicates an expected call of BeginTx.
func (*MockPgxPoolMockRecorder) BeginTxFunc ¶
func (mr *MockPgxPoolMockRecorder) BeginTxFunc(arg0, arg1, arg2 interface{}) *gomock.Call
BeginTxFunc indicates an expected call of BeginTxFunc.
func (*MockPgxPoolMockRecorder) Close ¶
func (mr *MockPgxPoolMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockPgxPoolMockRecorder) Config ¶
func (mr *MockPgxPoolMockRecorder) Config() *gomock.Call
Config indicates an expected call of Config.
func (*MockPgxPoolMockRecorder) CopyFrom ¶
func (mr *MockPgxPoolMockRecorder) CopyFrom(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
CopyFrom indicates an expected call of CopyFrom.
func (*MockPgxPoolMockRecorder) Exec ¶
func (mr *MockPgxPoolMockRecorder) Exec(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
Exec indicates an expected call of Exec.
func (*MockPgxPoolMockRecorder) Ping ¶
func (mr *MockPgxPoolMockRecorder) Ping(arg0 interface{}) *gomock.Call
Ping indicates an expected call of Ping.
func (*MockPgxPoolMockRecorder) Query ¶
func (mr *MockPgxPoolMockRecorder) Query(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
Query indicates an expected call of Query.
func (*MockPgxPoolMockRecorder) QueryRow ¶
func (mr *MockPgxPoolMockRecorder) QueryRow(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
QueryRow indicates an expected call of QueryRow.
func (*MockPgxPoolMockRecorder) Reset ¶
func (mr *MockPgxPoolMockRecorder) Reset() *gomock.Call
Reset indicates an expected call of Reset.
func (*MockPgxPoolMockRecorder) SendBatch ¶
func (mr *MockPgxPoolMockRecorder) SendBatch(arg0, arg1 interface{}) *gomock.Call
SendBatch indicates an expected call of SendBatch.
func (*MockPgxPoolMockRecorder) Stat ¶
func (mr *MockPgxPoolMockRecorder) Stat() *gomock.Call
Stat indicates an expected call of Stat.
type MockPgxTx ¶ added in v5.0.1
type MockPgxTx struct {
// contains filtered or unexported fields
}
MockPgxTx is a mock of pgx.Tx interface.
func NewMockPgxTx ¶ added in v5.0.1
func NewMockPgxTx(ctrl *gomock.Controller) *MockPgxTx
NewMockPgxTx creates a new mock instance.
func (*MockPgxTx) Conn ¶ added in v5.0.1
func (m *MockPgxTx) Conn() *pgx.Conn
Conn mocks base method.
func (*MockPgxTx) CopyFrom ¶ added in v5.0.1
func (m *MockPgxTx) CopyFrom(arg0 context.Context, arg1 pgx.Identifier, arg2 []string, arg3 pgx.CopyFromSource) (int64, error)
CopyFrom mocks base method.
func (*MockPgxTx) EXPECT ¶ added in v5.0.1
func (m *MockPgxTx) EXPECT() *MockPgxTxMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPgxTx) Exec ¶ added in v5.0.1
func (m *MockPgxTx) Exec(arg0 context.Context, arg1 string, arg2 ...interface{}) (pgconn.CommandTag, error)
Exec mocks base method.
func (*MockPgxTx) LargeObjects ¶ added in v5.0.1
func (m *MockPgxTx) LargeObjects() pgx.LargeObjects
LargeObjects mocks base method.
func (*MockPgxTx) Prepare ¶ added in v5.0.1
func (m *MockPgxTx) Prepare(arg0 context.Context, arg1 string, arg2 string) (*pgconn.StatementDescription, error)
Prepare mocks base method.
type MockPgxTxMockRecorder ¶ added in v5.0.1
type MockPgxTxMockRecorder struct {
// contains filtered or unexported fields
}
MockPgxTxMockRecorder is the mock recorder for MockPgxTx.
func (*MockPgxTxMockRecorder) Begin ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Begin(ctx interface{}) *gomock.Call
Begin indicates an expected call of Begin.
func (*MockPgxTxMockRecorder) Commit ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Commit(ctx interface{}) *gomock.Call
Commit indicates an expected call of Commit.
func (*MockPgxTxMockRecorder) Conn ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Conn() *gomock.Call
Conn indicates an expected call of Conn.
func (*MockPgxTxMockRecorder) CopyFrom ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) CopyFrom(ctx, tableName, columnNames, rowSrc interface{}) *gomock.Call
CopyFrom indicates an expected call of CopyFrom.
func (*MockPgxTxMockRecorder) Exec ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Exec(ctx, sql, arguments interface{}) *gomock.Call
Exec indicates an expected call of Exec.
func (*MockPgxTxMockRecorder) LargeObjects ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) LargeObjects() *gomock.Call
LargeObjects indicates an expected call of LargeObjects.
func (*MockPgxTxMockRecorder) Prepare ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Prepare(ctx, name, sql interface{}) *gomock.Call
Prepare indicates an expected call of Prepare.
func (*MockPgxTxMockRecorder) Query ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Query(ctx, sql, args interface{}) *gomock.Call
Query indicates an expected call of Query.
func (*MockPgxTxMockRecorder) QueryRow ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) QueryRow(ctx, sql, args interface{}) *gomock.Call
QueryRow indicates an expected call of QueryRow.
func (*MockPgxTxMockRecorder) Rollback ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) Rollback(ctx interface{}) *gomock.Call
Rollback indicates an expected call of Rollback.
func (*MockPgxTxMockRecorder) SendBatch ¶ added in v5.0.1
func (mr *MockPgxTxMockRecorder) SendBatch(ctx, b interface{}) *gomock.Call
SendBatch indicates an expected call of SendBatch.
type PgxPool ¶
type PgxPool interface { Acquire(ctx context.Context) (*pgxpool.Conn, error) AcquireAllIdle(ctx context.Context) []*pgxpool.Conn AcquireFunc(ctx context.Context, f func(*pgxpool.Conn) error) error Begin(ctx context.Context) (pgx.Tx, error) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error) Close() Config() *pgxpool.Config CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) Ping(ctx context.Context) error Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row Reset() SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults Stat() *pgxpool.Stat }
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row is a mocked row that can be returned from QueryRow
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows is a mocked collection of rows to return for Query result
func NewRows ¶
NewMockRows allows Rows to be created from a sql interface{} slice or from the CSV string and to be used as sql driver.Rows. Use Sqlmock.NewRows instead if using a custom converter
func NewRowsWithColumnDefinition ¶
func NewRowsWithColumnDefinition(columns ...pgconn.FieldDescription) *Rows
NewRowsWithColumnDefinition return rows with columns metadata
func (*Rows) AddRow ¶
AddRow composed from database interface{} slice return the same instance to perform subsequent actions. Note that the number of values must match the number of columns
func (*Rows) CloseError ¶
CloseError allows to set an error which will be returned by rows.Close function.
The close error will be triggered only in cases when rows.Next() EOF was not yet reached, that is a default sql library behavior
func (*Rows) FromCSVString ¶
FromCSVString build rows from csv string. return the same instance to perform subsequent actions. Note that the number of values must match the number of columns