Skip to content

Commit e7643cd

Browse files
committed
fix: incorrect codegen when more than 1 noArg invalidate
1 parent e76185f commit e7643cd

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ as this combo.
1818

1919
Production versions:
2020

21-
+ sqlc: v2.1.9-wicked-fork
21+
+ sqlc: v2.1.10-wicked-fork
2222
+ dcache: v0.1.3
2323
+ wgpx: v0.2.2
2424

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
7676
_ = q.db.PostExec(func() error {
7777
var anyErr error
7878
{{ range .Invalidates -}}
79+
{
7980
{{ if not .NoArg -}}
8081
if {{.ArgName}} != nil {
8182
{{ end -}}
@@ -89,6 +90,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
8990
{{ if not .NoArg -}}
9091
}
9192
{{ end -}}
93+
}
9294
{{ end -}}
9395
return anyErr
9496
})
@@ -158,6 +160,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
158160
_ = q.db.PostExec(func() error {
159161
var anyErr error
160162
{{ range .Invalidates -}}
163+
{
161164
{{ if not .NoArg -}}
162165
if {{.ArgName}} != nil {
163166
{{ end -}}
@@ -171,6 +174,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
171174
{{ if not .NoArg -}}
172175
}
173176
{{ end -}}
177+
}
174178
{{ end -}}
175179
return anyErr
176180
})
@@ -192,6 +196,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
192196
_ = q.db.PostExec(func() error {
193197
var anyErr error
194198
{{ range .Invalidates -}}
199+
{
195200
{{ if not .NoArg -}}
196201
if {{.ArgName}} != nil {
197202
{{ end -}}
@@ -205,6 +210,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
205210
{{ if not .NoArg -}}
206211
}
207212
{{ end -}}
213+
}
208214
{{ end -}}
209215
return anyErr
210216
})
@@ -226,6 +232,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
226232
_ = q.db.PostExec(func() error {
227233
var anyErr error
228234
{{ range .Invalidates -}}
235+
{
229236
{{ if not .NoArg -}}
230237
if {{.ArgName}} != nil {
231238
{{ end -}}
@@ -239,6 +246,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
239246
{{ if not .NoArg -}}
240247
}
241248
{{ end -}}
249+
}
242250
{{ end -}}
243251
return anyErr
244252
})
@@ -260,6 +268,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
260268
_ = q.db.PostExec(func() error {
261269
var anyErr error
262270
{{ range .Invalidates -}}
271+
{
263272
{{ if not .NoArg -}}
264273
if {{.ArgName}} != nil {
265274
{{ end -}}
@@ -273,6 +282,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
273282
{{ if not .NoArg -}}
274283
}
275284
{{ end -}}
285+
}
276286
{{ end -}}
277287
return anyErr
278288
})

0 commit comments

Comments
 (0)