Documentation ¶
Index ¶
- type Conn
- func (c Conn) Begin() (driver.Tx, error)
- func (c Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (c Conn) Close() error
- func (c Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (c Conn) OpenConnector(name string) (driver.Connector, error)
- func (c Conn) Ping(ctx context.Context) error
- func (c Conn) Prepare(query string) (driver.Stmt, error)
- func (c Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (c Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- type Driver
- type Result
- type Rows
- type Stmt
- type Tx
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is used to override driver.Conn interface methods to mock the outputs of the querries.
func (Conn) BeginTx ¶
BeginTx mocks the encoded outputs of BeginTx in test mode and captures encoded outputs in capture mode.
func (Conn) ExecContext ¶
func (c Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext is the mocked method of driver.ExecerContext interface. Parameters and returned variables are same as ExecContext method of database/sql/driver package.
Note: ctx parameter should be the http's request context. If you are using gorm then, first call gorm.DB.WithContext(r.Context()) in your Handler function.
func (Conn) PrepareContext ¶
PrepareContext mocks the outputs of PrepareContext method of sql/driver's ConnPrepareContext interface.
type Result ¶
Result is used to encode/decode driver.Result interface so that, its outputs could be stored in the keploy context.
func (Result) LastInsertId ¶
func (Result) RowsAffected ¶
type Rows ¶
Rows mocks the driver.Rows methods to store their encoded outputs.
type Tx ¶
Tx wraps driver.Tx to mock its methods output.