Skip to content

Commit f220086

Browse files
committed
use queryretval template func to avoid rewriting test output
1 parent 1019343 commit f220086

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/codegen/golang/templates/pgx/queryCode.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,17 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, er
115115
{{end -}}
116116
{{- if $.EmitMethodsWithDBArgument -}}
117117
func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (pgconn.CommandTag, error) {
118-
result, err := db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
118+
{{queryRetval .}} db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
119119
{{- else -}}
120120
func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error) {
121-
result, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
121+
{{queryRetval .}} q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
122122
{{- end}}
123123
{{- if $.WrapErrors}}
124124
if err != nil {
125125
err = fmt.Errorf("error executing query {{.MethodName}}: %w", err)
126126
}
127-
{{- end}}
128127
return result, err
128+
{{- end}}
129129
}
130130
{{end}}
131131

0 commit comments

Comments
 (0)