Exec logs its params and calls the underlying driver Exec method.
(ctx context.Context, query string, args, v any)
| 28 | |
| 29 | // Exec logs its params and calls the underlying driver Exec method. |
| 30 | func (d *DebugDriver) Exec(ctx context.Context, query string, args, v any) error { |
| 31 | start := time.Now() |
| 32 | err := d.Driver.Exec(ctx, query, args, v) |
| 33 | if skip, ok := ctx.Value(SkipDbLogging{}).(bool); ok && skip { |
| 34 | return err |
| 35 | } |
| 36 | |
| 37 | d.log(ctx, fmt.Sprintf("driver.Exec: query=%v args=%v time=%v", query, args, time.Since(start))) |
| 38 | return err |
| 39 | } |
| 40 | |
| 41 | // ExecContext logs its params and calls the underlying driver ExecContext method if it is supported. |
| 42 | func (d *DebugDriver) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) { |