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

Method Exec

inventory/debug/debug.go:119–135  ·  view source on GitHub ↗

Exec logs its params and calls the underlying transaction Exec method.

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

Source from the content-addressed store, hash-verified

117
118// Exec logs its params and calls the underlying transaction Exec method.
119func (d *DebugTx) Exec(ctx context.Context, query string, args, v any) error {
120 start := time.Now()
121 err := d.Tx.Exec(ctx, query, args, v)
122 printArgs := args
123 if argsArray, ok := args.([]interface{}); ok {
124 for i, argVal := range argsArray {
125 if argValStr, ok := argVal.(string); ok && len(argValStr) > strMaxLen {
126 printArgs.([]interface{})[i] = argValStr[:strMaxLen] + "...[Truncated]..."
127 }
128 }
129 }
130 if skip, ok := ctx.Value(SkipDbLogging{}).(bool); ok && skip {
131 return err
132 }
133 d.log(ctx, fmt.Sprintf("Tx(%s).Exec: query=%v args=%v time=%v", d.id, query, args, time.Since(start)))
134 return err
135}
136
137// ExecContext logs its params and calls the underlying transaction ExecContext method if it is supported.
138func (d *DebugTx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) {

Callers

nothing calls this directly

Calls 3

ExecMethod · 0.65
SinceMethod · 0.65
ValueMethod · 0.45

Tested by

no test coverage detected