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

Method QueryContext

inventory/debug/debug.go:68–80  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

66
67// QueryContext logs its params and calls the underlying driver QueryContext method if it is supported.
68func (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.
83func (d *DebugDriver) Tx(ctx context.Context) (dialect.Tx, error) {

Callers

nothing calls this directly

Calls 2

ValueMethod · 0.45
QueryContextMethod · 0.45

Tested by

no test coverage detected