Documentation ¶
Index ¶
- func CaptureSqlMocks(kctx *internal.Context, log *zap.Logger, meta map[string]string, ...)
- func MockSqlFromYaml(kctx *internal.Context, meta map[string]string) (sqlOutput, bool)
- 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
- func (s *Stmt) Close() error
- func (s *Stmt) Exec(args []driver.Value) (driver.Result, error)
- func (c *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
- func (s *Stmt) NumInput() int
- func (s *Stmt) Query(args []driver.Value) (driver.Rows, error)
- func (c *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
- type Tx
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureSqlMocks ¶
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 queries.
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 Stmt ¶
Stmt wraps the driver.Stmt to mock its method's outputs.
func (*Stmt) ExecContext ¶
func (*Stmt) QueryContext ¶
type Tx ¶
Tx wraps driver.Tx to mock its methods output.