MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / ExecContext

Method ExecContext

inventory/debug/debug.go:42–54  ·  view source on GitHub ↗

ExecContext logs its params and calls the underlying driver ExecContext method if it is supported.

(ctx context.Context, query string, args ...any)

Source from the content-addressed store, hash-verified

40
41// ExecContext logs its params and calls the underlying driver ExecContext method if it is supported.
42func (d *DebugDriver) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) {
43 drv, ok := d.Driver.(interface {
44 ExecContext(context.Context, string, ...any) (sql.Result, error)
45 })
46 if !ok {
47 return nil, fmt.Errorf("Driver.ExecContext is not supported")
48 }
49 if skip, ok := ctx.Value(SkipDbLogging{}).(bool); ok && skip {
50 return drv.ExecContext(ctx, query, args...)
51 }
52 d.log(ctx, fmt.Sprintf("driver.ExecContext: query=%v args=%v", query, args))
53 return drv.ExecContext(ctx, query, args...)
54}
55
56// Query logs its params and calls the underlying driver Query method.
57func (d *DebugDriver) Query(ctx context.Context, query string, args, v any) error {

Callers

nothing calls this directly

Calls 2

ValueMethod · 0.45
ExecContextMethod · 0.45

Tested by

no test coverage detected