Documentation ¶
Overview ¶
Package sqldrivermock provides a basic null implementation of "database/sql/driver".Driver
Index ¶
- type Driver
- type Expect
- type ExpectationMismatchError
- type ExpectedCommit
- type ExpectedConn
- type ExpectedExec
- type ExpectedQuery
- type ExpectedRollback
- type ExpectedStmt
- type ExpectedTx
- func (et *ExpectedTx) Commit() *ExpectedCommit
- func (et *ExpectedTx) Prepare() *ExpectedStmt
- func (et *ExpectedTx) Rollback() *ExpectedRollback
- func (et *ExpectedTx) String() string
- func (et *ExpectedTx) WillError(err error) *ExpectedTx
- func (et *ExpectedTx) WithOptions(opts driver.TxOptions) *ExpectedTx
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct { Logf func(string, ...interface{}) // contains filtered or unexported fields }
Driver is a mock implementation of database/sql/driver.Driver
type Expect ¶
type Expect struct {
// contains filtered or unexported fields
}
Expect is a series of expectations of Driver
type ExpectationMismatchError ¶
type ExpectationMismatchError struct {
// contains filtered or unexported fields
}
ExpectationMismatchError is provided when a recorded event doesn't match expected type
func (ExpectationMismatchError) Actual ¶
func (err ExpectationMismatchError) Actual() interface{}
Actual is the actual event
func (ExpectationMismatchError) Error ¶
func (err ExpectationMismatchError) Error() string
func (ExpectationMismatchError) Expected ¶
func (err ExpectationMismatchError) Expected() interface{}
Expected is the expected event
type ExpectedCommit ¶
type ExpectedCommit struct {
// contains filtered or unexported fields
}
ExpectedCommit is the set of expectations for a call to driver.Tx.Commit
func (*ExpectedCommit) String ¶
func (ec *ExpectedCommit) String() string
func (*ExpectedCommit) WillError ¶
func (ec *ExpectedCommit) WillError(err error)
WillError provides an error that will be returned by the call to Commit
type ExpectedConn ¶
type ExpectedConn struct {
// contains filtered or unexported fields
}
ExpectedConn is the set of expecatations for a driver.Conn
func (*ExpectedConn) Begin ¶
func (ec *ExpectedConn) Begin() *ExpectedTx
Begin expects a call to driver.Conn.Begin
func (*ExpectedConn) Prepare ¶
func (ec *ExpectedConn) Prepare() *ExpectedStmt
Prepare expects a call to drvier.Conn.Prepare
func (*ExpectedConn) String ¶
func (ec *ExpectedConn) String() string
func (*ExpectedConn) WillError ¶
func (ec *ExpectedConn) WillError(err error)
WillError specifies an error that will be returned by driver.Open
func (*ExpectedConn) WithDSN ¶
func (ec *ExpectedConn) WithDSN(dsn string) *ExpectedConn
WithDSN sets the expected DSN for the connection
type ExpectedExec ¶
type ExpectedExec struct {
// contains filtered or unexported fields
}
ExpectedExec is the set of expectations for a call to driver.Stmt.Query
func (*ExpectedExec) String ¶
func (ee *ExpectedExec) String() string
func (*ExpectedExec) WillError ¶
func (ee *ExpectedExec) WillError(err error)
WillError specifies an error that will be returned by Exec
func (*ExpectedExec) WithArgs ¶
func (ee *ExpectedExec) WithArgs(args ...driver.Value) *ExpectedExec
WithArgs sets the expected set of arguments for the execution
type ExpectedQuery ¶
type ExpectedQuery struct {
// contains filtered or unexported fields
}
ExpectedQuery is the set of expectations for a call to driver.Stmt.Query
func (*ExpectedQuery) String ¶
func (eq *ExpectedQuery) String() string
func (*ExpectedQuery) WillError ¶
func (eq *ExpectedQuery) WillError(err error)
WillError specifies an error that will be returned by Query
func (*ExpectedQuery) WithArgs ¶
func (eq *ExpectedQuery) WithArgs(args ...driver.Value) *ExpectedQuery
WithArgs sets the expected set of arguments for the query
type ExpectedRollback ¶
type ExpectedRollback struct {
// contains filtered or unexported fields
}
ExpectedRollback is the set of expectations for a call to driver.Tx.Rollback
func (*ExpectedRollback) String ¶
func (er *ExpectedRollback) String() string
func (*ExpectedRollback) WillError ¶
func (er *ExpectedRollback) WillError(err error)
WillError provides an error that will be returned by the call to Rollback
type ExpectedStmt ¶
type ExpectedStmt struct {
// contains filtered or unexported fields
}
ExpectedStmt is the set of expectations for a driver.Stmt
func (*ExpectedStmt) Exec ¶
func (es *ExpectedStmt) Exec() *ExpectedExec
Exec expects a call to driver.Stmt.Exec
func (*ExpectedStmt) Query ¶
func (es *ExpectedStmt) Query() *ExpectedQuery
Query expects a call to driver.Stmt.Query
func (*ExpectedStmt) String ¶
func (es *ExpectedStmt) String() string
func (*ExpectedStmt) WillError ¶
func (es *ExpectedStmt) WillError(err error)
WillError specifies an error that will be returned by Prepare
func (*ExpectedStmt) WithQuery ¶
func (es *ExpectedStmt) WithQuery(qs string) *ExpectedStmt
WithQuery sets the expected query string
type ExpectedTx ¶
type ExpectedTx struct {
// contains filtered or unexported fields
}
ExpectedTx is the set of expectations for a driver.Tx
func (*ExpectedTx) Commit ¶
func (et *ExpectedTx) Commit() *ExpectedCommit
Commit expects a call to driver.Tx.Commit
func (*ExpectedTx) Prepare ¶
func (et *ExpectedTx) Prepare() *ExpectedStmt
Prepare expects a call to drvier.Conn.Prepare
func (*ExpectedTx) Rollback ¶
func (et *ExpectedTx) Rollback() *ExpectedRollback
Rollback expects a call to driver.Tx.Rollback
func (*ExpectedTx) String ¶
func (et *ExpectedTx) String() string
func (*ExpectedTx) WillError ¶
func (et *ExpectedTx) WillError(err error) *ExpectedTx
WillError provides an error that will be returned by the call to Begin
func (*ExpectedTx) WithOptions ¶
func (et *ExpectedTx) WithOptions(opts driver.TxOptions) *ExpectedTx
WithOptions sets the expected TxOptions