Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use queryretval template func to avoid rewriting test output
  • Loading branch information
andrewmbenton committed Mar 9, 2025
commit f2200867c762fb45b62c11be5389d287c28870e5
6 changes: 3 additions & 3 deletions internal/codegen/golang/templates/pgx/queryCode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, er
{{end -}}
{{- if $.EmitMethodsWithDBArgument -}}
func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (pgconn.CommandTag, error) {
result, err := db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
{{queryRetval .}} db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
{{- else -}}
func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error) {
result, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
{{queryRetval .}} q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}})
{{- end}}
{{- if $.WrapErrors}}
if err != nil {
err = fmt.Errorf("error executing query {{.MethodName}}: %w", err)
}
{{- end}}
return result, err
{{- end}}
}
{{end}}

Expand Down
Loading