QueryContext logs its params and calls the underlying transaction QueryContext method if it is supported.
(ctx context.Context, query string, args ...any)
| 162 | |
| 163 | // QueryContext logs its params and calls the underlying transaction QueryContext method if it is supported. |
| 164 | func (d *DebugTx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) { |
| 165 | drv, ok := d.Tx.(interface { |
| 166 | QueryContext(context.Context, string, ...any) (*sql.Rows, error) |
| 167 | }) |
| 168 | if !ok { |
| 169 | return nil, fmt.Errorf("Tx.QueryContext is not supported") |
| 170 | } |
| 171 | if skip, ok := ctx.Value(SkipDbLogging{}).(bool); ok && skip { |
| 172 | return drv.QueryContext(ctx, query, args...) |
| 173 | } |
| 174 | d.log(ctx, fmt.Sprintf("Tx(%s).QueryContext: query=%v args=%v", d.id, query, args)) |
| 175 | return drv.QueryContext(ctx, query, args...) |
| 176 | } |
| 177 | |
| 178 | // Commit logs this step and calls the underlying transaction Commit method. |
| 179 | func (d *DebugTx) Commit() error { |