@@ -42,6 +42,7 @@ type tmplCtx struct {
4242 OmitSqlcVersion bool
4343 BuildTags string
4444 WrapErrors bool
45+ EmitSliceExpansion bool
4546}
4647
4748func (t * tmplCtx ) OutputQuery (sourceName string ) bool {
@@ -55,6 +56,10 @@ func (t *tmplCtx) codegenDbarg() string {
5556 return ""
5657}
5758
59+ func (t * tmplCtx ) shouldExpandSlices (q Query ) bool {
60+ return t .EmitSliceExpansion && q .Arg .HasSqlcSlices ()
61+ }
62+
5863// Called as a global method since subtemplate queryCodeStdExec does not have
5964// access to the toplevel tmplCtx
6065func (t * tmplCtx ) codegenEmitPreparedQueries () bool {
@@ -181,6 +186,7 @@ func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum,
181186 EmitMethodsWithDBArgument : options .EmitMethodsWithDbArgument ,
182187 EmitEnumValidMethod : options .EmitEnumValidMethod ,
183188 EmitAllEnumValues : options .EmitAllEnumValues ,
189+ EmitSliceExpansion : options .Engine != "ydb" ,
184190 UsesCopyFrom : usesCopyFrom (queries ),
185191 UsesBatch : usesBatch (queries ),
186192 SQLDriver : parseDriver (options .SqlPackage ),
@@ -218,8 +224,6 @@ func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum,
218224 }
219225 }
220226
221- isYDBEngine := func () bool { return options .Engine == "ydb" }
222-
223227 funcMap := template.FuncMap {
224228 "lowerTitle" : sdk .LowerTitle ,
225229 "comment" : sdk .DoubleSlashComment ,
@@ -234,7 +238,7 @@ func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum,
234238 "emitPreparedQueries" : tctx .codegenEmitPreparedQueries ,
235239 "queryMethod" : tctx .codegenQueryMethod ,
236240 "queryRetval" : tctx .codegenQueryRetval ,
237- "isYDBEngine " : isYDBEngine ,
241+ "shouldExpandSlices " : tctx . shouldExpandSlices ,
238242 }
239243
240244 tmpl := template .Must (
0 commit comments