Documentation
¶
Index ¶
- type PGXPoolMock
- func (mock *PGXPoolMock) Begin(ctx context.Context) (v4.Tx, error)
- func (mock *PGXPoolMock) BeginCalls() []struct{ ... }
- func (mock *PGXPoolMock) Close()
- func (mock *PGXPoolMock) CloseCalls() []struct{}
- func (mock *PGXPoolMock) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
- func (mock *PGXPoolMock) ExecCalls() []struct{ ... }
- func (mock *PGXPoolMock) Ping(ctx context.Context) error
- func (mock *PGXPoolMock) PingCalls() []struct{ ... }
- func (mock *PGXPoolMock) Query(ctx context.Context, sql string, args ...interface{}) (v4.Rows, error)
- func (mock *PGXPoolMock) QueryCalls() []struct{ ... }
- func (mock *PGXPoolMock) QueryRow(ctx context.Context, sql string, args ...interface{}) v4.Row
- func (mock *PGXPoolMock) QueryRowCalls() []struct{ ... }
- type PGXRowMock
- type PGXRowsMock
- func (mock *PGXRowsMock) Close()
- func (mock *PGXRowsMock) CloseCalls() []struct{}
- func (mock *PGXRowsMock) CommandTag() pgconn.CommandTag
- func (mock *PGXRowsMock) CommandTagCalls() []struct{}
- func (mock *PGXRowsMock) Err() error
- func (mock *PGXRowsMock) ErrCalls() []struct{}
- func (mock *PGXRowsMock) FieldDescriptions() []pgproto3.FieldDescription
- func (mock *PGXRowsMock) FieldDescriptionsCalls() []struct{}
- func (mock *PGXRowsMock) Next() bool
- func (mock *PGXRowsMock) NextCalls() []struct{}
- func (mock *PGXRowsMock) RawValues() [][]byte
- func (mock *PGXRowsMock) RawValuesCalls() []struct{}
- func (mock *PGXRowsMock) Scan(dest ...interface{}) error
- func (mock *PGXRowsMock) ScanCalls() []struct{ ... }
- func (mock *PGXRowsMock) Values() ([]interface{}, error)
- func (mock *PGXRowsMock) ValuesCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PGXPoolMock ¶
type PGXPoolMock struct {
// BeginFunc mocks the Begin method.
BeginFunc func(ctx context.Context) (v4.Tx, error)
// CloseFunc mocks the Close method.
CloseFunc func()
// ExecFunc mocks the Exec method.
ExecFunc func(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
// PingFunc mocks the Ping method.
PingFunc func(ctx context.Context) error
// QueryFunc mocks the Query method.
QueryFunc func(ctx context.Context, sql string, args ...interface{}) (v4.Rows, error)
// QueryRowFunc mocks the QueryRow method.
QueryRowFunc func(ctx context.Context, sql string, args ...interface{}) v4.Row
// contains filtered or unexported fields
}
PGXPoolMock is a mock implementation of pgx.PGXPool.
func TestSomethingThatUsesPGXPool(t *testing.T) {
// make and configure a mocked pgx.PGXPool
mockedPGXPool := &PGXPoolMock{
BeginFunc: func(ctx context.Context) (v4.Tx, error) {
panic("mock out the Begin method")
},
CloseFunc: func() {
panic("mock out the Close method")
},
ExecFunc: func(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) {
panic("mock out the Exec method")
},
PingFunc: func(ctx context.Context) error {
panic("mock out the Ping method")
},
QueryFunc: func(ctx context.Context, sql string, args ...interface{}) (v4.Rows, error) {
panic("mock out the Query method")
},
QueryRowFunc: func(ctx context.Context, sql string, args ...interface{}) v4.Row {
panic("mock out the QueryRow method")
},
}
// use mockedPGXPool in code that requires pgx.PGXPool
// and then make assertions.
}
func (*PGXPoolMock) BeginCalls ¶
func (mock *PGXPoolMock) BeginCalls() []struct { Ctx context.Context }
BeginCalls gets all the calls that were made to Begin. Check the length with:
len(mockedPGXPool.BeginCalls())
func (*PGXPoolMock) CloseCalls ¶
func (mock *PGXPoolMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedPGXPool.CloseCalls())
func (*PGXPoolMock) Exec ¶ added in v0.9.0
func (mock *PGXPoolMock) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
Exec calls ExecFunc.
func (*PGXPoolMock) ExecCalls ¶ added in v0.9.0
func (mock *PGXPoolMock) ExecCalls() []struct { Ctx context.Context SQL string Arguments []interface{} }
ExecCalls gets all the calls that were made to Exec. Check the length with:
len(mockedPGXPool.ExecCalls())
func (*PGXPoolMock) Ping ¶
func (mock *PGXPoolMock) Ping(ctx context.Context) error
Ping calls PingFunc.
func (*PGXPoolMock) PingCalls ¶
func (mock *PGXPoolMock) PingCalls() []struct { Ctx context.Context }
PingCalls gets all the calls that were made to Ping. Check the length with:
len(mockedPGXPool.PingCalls())
func (*PGXPoolMock) Query ¶
func (mock *PGXPoolMock) Query(ctx context.Context, sql string, args ...interface{}) (v4.Rows, error)
Query calls QueryFunc.
func (*PGXPoolMock) QueryCalls ¶
func (mock *PGXPoolMock) QueryCalls() []struct { Ctx context.Context SQL string Args []interface{} }
QueryCalls gets all the calls that were made to Query. Check the length with:
len(mockedPGXPool.QueryCalls())
func (*PGXPoolMock) QueryRowCalls ¶
func (mock *PGXPoolMock) QueryRowCalls() []struct { Ctx context.Context SQL string Args []interface{} }
QueryRowCalls gets all the calls that were made to QueryRow. Check the length with:
len(mockedPGXPool.QueryRowCalls())
type PGXRowMock ¶ added in v0.10.0
type PGXRowMock struct {
// ScanFunc mocks the Scan method.
ScanFunc func(dest ...interface{}) error
// contains filtered or unexported fields
}
PGXRowMock is a mock implementation of pgx.PGXRow.
func TestSomethingThatUsesPGXRow(t *testing.T) {
// make and configure a mocked pgx.PGXRow
mockedPGXRow := &PGXRowMock{
ScanFunc: func(dest ...interface{}) error {
panic("mock out the Scan method")
},
}
// use mockedPGXRow in code that requires pgx.PGXRow
// and then make assertions.
}
func (*PGXRowMock) Scan ¶ added in v0.10.0
func (mock *PGXRowMock) Scan(dest ...interface{}) error
Scan calls ScanFunc.
func (*PGXRowMock) ScanCalls ¶ added in v0.10.0
func (mock *PGXRowMock) ScanCalls() []struct { Dest []interface{} }
ScanCalls gets all the calls that were made to Scan. Check the length with:
len(mockedPGXRow.ScanCalls())
type PGXRowsMock ¶ added in v0.10.0
type PGXRowsMock struct {
// CloseFunc mocks the Close method.
CloseFunc func()
// CommandTagFunc mocks the CommandTag method.
CommandTagFunc func() pgconn.CommandTag
// ErrFunc mocks the Err method.
ErrFunc func() error
// FieldDescriptionsFunc mocks the FieldDescriptions method.
FieldDescriptionsFunc func() []pgproto3.FieldDescription
// NextFunc mocks the Next method.
NextFunc func() bool
// RawValuesFunc mocks the RawValues method.
RawValuesFunc func() [][]byte
// ScanFunc mocks the Scan method.
ScanFunc func(dest ...interface{}) error
// ValuesFunc mocks the Values method.
ValuesFunc func() ([]interface{}, error)
// contains filtered or unexported fields
}
PGXRowsMock is a mock implementation of pgx.PGXRows.
func TestSomethingThatUsesPGXRows(t *testing.T) {
// make and configure a mocked pgx.PGXRows
mockedPGXRows := &PGXRowsMock{
CloseFunc: func() {
panic("mock out the Close method")
},
CommandTagFunc: func() pgconn.CommandTag {
panic("mock out the CommandTag method")
},
ErrFunc: func() error {
panic("mock out the Err method")
},
FieldDescriptionsFunc: func() []pgproto3.FieldDescription {
panic("mock out the FieldDescriptions method")
},
NextFunc: func() bool {
panic("mock out the Next method")
},
RawValuesFunc: func() [][]byte {
panic("mock out the RawValues method")
},
ScanFunc: func(dest ...interface{}) error {
panic("mock out the Scan method")
},
ValuesFunc: func() ([]interface{}, error) {
panic("mock out the Values method")
},
}
// use mockedPGXRows in code that requires pgx.PGXRows
// and then make assertions.
}
func (*PGXRowsMock) Close ¶ added in v0.10.0
func (mock *PGXRowsMock) Close()
Close calls CloseFunc.
func (*PGXRowsMock) CloseCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedPGXRows.CloseCalls())
func (*PGXRowsMock) CommandTag ¶ added in v0.10.0
func (mock *PGXRowsMock) CommandTag() pgconn.CommandTag
CommandTag calls CommandTagFunc.
func (*PGXRowsMock) CommandTagCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) CommandTagCalls() []struct { }
CommandTagCalls gets all the calls that were made to CommandTag. Check the length with:
len(mockedPGXRows.CommandTagCalls())
func (*PGXRowsMock) ErrCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) ErrCalls() []struct { }
ErrCalls gets all the calls that were made to Err. Check the length with:
len(mockedPGXRows.ErrCalls())
func (*PGXRowsMock) FieldDescriptions ¶ added in v0.10.0
func (mock *PGXRowsMock) FieldDescriptions() []pgproto3.FieldDescription
FieldDescriptions calls FieldDescriptionsFunc.
func (*PGXRowsMock) FieldDescriptionsCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) FieldDescriptionsCalls() []struct { }
FieldDescriptionsCalls gets all the calls that were made to FieldDescriptions. Check the length with:
len(mockedPGXRows.FieldDescriptionsCalls())
func (*PGXRowsMock) Next ¶ added in v0.10.0
func (mock *PGXRowsMock) Next() bool
Next calls NextFunc.
func (*PGXRowsMock) NextCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) NextCalls() []struct { }
NextCalls gets all the calls that were made to Next. Check the length with:
len(mockedPGXRows.NextCalls())
func (*PGXRowsMock) RawValues ¶ added in v0.10.0
func (mock *PGXRowsMock) RawValues() [][]byte
RawValues calls RawValuesFunc.
func (*PGXRowsMock) RawValuesCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) RawValuesCalls() []struct { }
RawValuesCalls gets all the calls that were made to RawValues. Check the length with:
len(mockedPGXRows.RawValuesCalls())
func (*PGXRowsMock) Scan ¶ added in v0.10.0
func (mock *PGXRowsMock) Scan(dest ...interface{}) error
Scan calls ScanFunc.
func (*PGXRowsMock) ScanCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) ScanCalls() []struct { Dest []interface{} }
ScanCalls gets all the calls that were made to Scan. Check the length with:
len(mockedPGXRows.ScanCalls())
func (*PGXRowsMock) Values ¶ added in v0.10.0
func (mock *PGXRowsMock) Values() ([]interface{}, error)
Values calls ValuesFunc.
func (*PGXRowsMock) ValuesCalls ¶ added in v0.10.0
func (mock *PGXRowsMock) ValuesCalls() []struct { }
ValuesCalls gets all the calls that were made to Values. Check the length with:
len(mockedPGXRows.ValuesCalls())