From 8ec7acb9cc8f3fc19ad760ca1314b1e3e19653f9 Mon Sep 17 00:00:00 2001 From: SoMuchForSubtlety Date: Tue, 11 Jul 2023 11:38:41 +0200 Subject: [PATCH] Fix code geneation for sqlc.slice Fixes #2430 --- internal/codegen/golang/templates/stdlib/queryCode.tmpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/codegen/golang/templates/stdlib/queryCode.tmpl b/internal/codegen/golang/templates/stdlib/queryCode.tmpl index f9b5899286..6eca49cd17 100644 --- a/internal/codegen/golang/templates/stdlib/queryCode.tmpl +++ b/internal/codegen/golang/templates/stdlib/queryCode.tmpl @@ -142,7 +142,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", "NULL", 1) } {{- end }} + {{- if emitPreparedQueries }} + {{ queryRetval . }} {{ queryMethod . }}(ctx, nil, query, queryParams...) + {{- else}} {{ queryRetval . }} {{ queryMethod . }}(ctx, query, queryParams...) + {{- end -}} {{- else if emitPreparedQueries }} {{- queryRetval . }} {{ queryMethod . }}(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}}) {{- else}}