QueryContext logs its params and calls the underlying driver QueryContext method if it is supported.
(ctx context.Context, query string, args ...any)
| 66 | |
| 67 | // QueryContext logs its params and calls the underlying driver QueryContext method if it is supported. |
| 68 | func (d *DebugDriver) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) { |
| 69 | drv, ok := d.Driver.(interface { |
| 70 | QueryContext(context.Context, string, ...any) (*sql.Rows, error) |
| 71 | }) |
| 72 | if !ok { |
| 73 | return nil, fmt.Errorf("Driver.QueryContext is not supported") |
| 74 | } |
| 75 | if skip, ok := ctx.Value(SkipDbLogging{}).(bool); ok && skip { |
| 76 | return drv.QueryContext(ctx, query, args...) |
| 77 | } |
| 78 | d.log(ctx, fmt.Sprintf("driver.QueryContext: query=%v args=%v", query, args)) |
| 79 | return drv.QueryContext(ctx, query, args...) |
| 80 | } |
| 81 | |
| 82 | // Tx adds an log-id for the transaction and calls the underlying driver Tx command. |
| 83 | func (d *DebugDriver) Tx(ctx context.Context) (dialect.Tx, error) { |
nothing calls this directly
no test coverage detected