Documentation ¶
Index ¶
- func NewFakeFactory(fakeSR *SQLRunner) mysql.SQLRunnerFactory
- type SQLCall
- type SQLRunner
- func (qr *SQLRunner) AddExpectedCalls(expectedCalls ...SQLCall)
- func (qr *SQLRunner) AddExpectedDSN(expectedDSN string)
- func (qr *SQLRunner) AllowExtraCalls()
- func (qr *SQLRunner) AssertDSN(dsn string)
- func (qr *SQLRunner) AssertNoCallsLeft()
- func (qr *SQLRunner) DisallowExtraCalls()
- func (qr *SQLRunner) PurgeExpectedCalls()
- func (qr *SQLRunner) QueryExec(_ context.Context, query mysql.Query) error
- func (qr *SQLRunner) QueryRow(_ context.Context, query mysql.Query, _ ...interface{}) error
- func (qr *SQLRunner) QueryRows(_ context.Context, query mysql.Query) (mysql.Rows, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeFactory ¶
func NewFakeFactory(fakeSR *SQLRunner) mysql.SQLRunnerFactory
NewFakeFactory returns a mysql.SQLRunnerFactory but with the fake SQLRunner received as parameter
Types ¶
type SQLRunner ¶
type SQLRunner struct {
// contains filtered or unexported fields
}
SQLRunner implements a fake query runner that can be used for mocking in tests
func NewQueryRunner ¶
NewQueryRunner will create a new fake.SQLRunner
func (*SQLRunner) AddExpectedCalls ¶
AddExpectedCalls appends a "run" function, that will be called and discarded the next time the query runner will be used
func (*SQLRunner) AddExpectedDSN ¶ added in v0.6.3
AddExpectedDSN add a expected DSN to the fake SQLRunner for later assert.
func (*SQLRunner) AllowExtraCalls ¶
func (qr *SQLRunner) AllowExtraCalls()
AllowExtraCalls will allow the fake query runner to be used without expecting any calls
func (*SQLRunner) AssertNoCallsLeft ¶
func (qr *SQLRunner) AssertNoCallsLeft()
AssertNoCallsLeft can be used to assert that there are no expected remaining query runner calls
func (*SQLRunner) DisallowExtraCalls ¶
func (qr *SQLRunner) DisallowExtraCalls()
DisallowExtraCalls will disallow the fake query runner to be used without expecting any calls
func (*SQLRunner) PurgeExpectedCalls ¶
func (qr *SQLRunner) PurgeExpectedCalls()
PurgeExpectedCalls removes all the expected query runner calls