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

Method QueryContext

inventory/debug/debug.go:164–176  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

162
163// QueryContext logs its params and calls the underlying transaction QueryContext method if it is supported.
164func (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.
179func (d *DebugTx) Commit() error {

Callers 1

QueryContextMethod · 0.45

Calls 1

ValueMethod · 0.45

Tested by

no test coverage detected