Skip to content

Commit

Permalink
fix: incorrect codegen when more than 1 noArg invalidate
Browse files Browse the repository at this point in the history
  • Loading branch information
Stumble committed Apr 10, 2024
1 parent e76185f commit e7643cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ as this combo.

Production versions:

+ sqlc: v2.1.9-wicked-fork
+ sqlc: v2.1.10-wicked-fork
+ dcache: v0.1.3
+ wgpx: v0.2.2

Expand Down
10 changes: 10 additions & 0 deletions internal/codegen/golang/templates/wpgx/queryCode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
_ = q.db.PostExec(func() error {
var anyErr error
{{ range .Invalidates -}}
{
{{ if not .NoArg -}}
if {{.ArgName}} != nil {
{{ end -}}
Expand All @@ -89,6 +90,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
{{ if not .NoArg -}}
}
{{ end -}}
}
{{ end -}}
return anyErr
})
Expand Down Expand Up @@ -158,6 +160,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
_ = q.db.PostExec(func() error {
var anyErr error
{{ range .Invalidates -}}
{
{{ if not .NoArg -}}
if {{.ArgName}} != nil {
{{ end -}}
Expand All @@ -171,6 +174,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
{{ if not .NoArg -}}
}
{{ end -}}
}
{{ end -}}
return anyErr
})
Expand All @@ -192,6 +196,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
_ = q.db.PostExec(func() error {
var anyErr error
{{ range .Invalidates -}}
{
{{ if not .NoArg -}}
if {{.ArgName}} != nil {
{{ end -}}
Expand All @@ -205,6 +210,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
{{ if not .NoArg -}}
}
{{ end -}}
}
{{ end -}}
return anyErr
})
Expand All @@ -226,6 +232,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
_ = q.db.PostExec(func() error {
var anyErr error
{{ range .Invalidates -}}
{
{{ if not .NoArg -}}
if {{.ArgName}} != nil {
{{ end -}}
Expand All @@ -239,6 +246,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
{{ if not .NoArg -}}
}
{{ end -}}
}
{{ end -}}
return anyErr
})
Expand All @@ -260,6 +268,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
_ = q.db.PostExec(func() error {
var anyErr error
{{ range .Invalidates -}}
{
{{ if not .NoArg -}}
if {{.ArgName}} != nil {
{{ end -}}
Expand All @@ -273,6 +282,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
{{ if not .NoArg -}}
}
{{ end -}}
}
{{ end -}}
return anyErr
})
Expand Down

0 comments on commit e7643cd

Please sign in to comment.