Skip to content

Commit

Permalink
Fix schema in query context
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Santi committed Jul 23, 2024
1 parent 9e01a10 commit 1672278
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion internal/codegen/golang/templates/stdlib/queryCode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}

{{define "queryCodeStdExec"}}
{{- if .Arg.HasSqlcSlices }}
query := {{.ConstantName}}
query := strings.ReplaceAll({{.ConstantName}}, "%s", schema)
var queryParams []interface{}
{{- if .Arg.Struct }}
{{- $arg := .Arg }}
Expand Down Expand Up @@ -186,6 +186,10 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}
{{- else if emitPreparedQueries }}
{{- queryRetval . }} {{ queryMethod . }}(ctx, q.{{.FieldName}}, {{.ConstantName}}, {{.Arg.Params}})
{{- else}}
{{- if emitSchemaName }}
{{- queryRetval . }} {{ queryMethod . }}(ctx, strings.ReplaceAll({{.ConstantName}}, "%s", schema), {{.Arg.Params}})
{{- else }}
{{- queryRetval . }} {{ queryMethod . }}(ctx, {{.ConstantName}}, {{.Arg.Params}})
{{- end -}}
{{- end -}}
{{end}}
3 changes: 0 additions & 3 deletions internal/codegen/golang/templates/template.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ import (
{{end}}
{{end}}

{{- if emitSchemaName }}
"strings"
{{- end }}
)
{{end}}

Expand Down

0 comments on commit 1672278

Please sign in to comment.