Skip to content

Commit

Permalink
fix missing schema in table alias in pkEQ and pkIN clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
adatob committed Dec 13, 2024
1 parent 3723387 commit d68dc91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gen/templates/models/table/05_one_methods.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (o *{{$tAlias.UpSingular}}) PrimaryKeyVals() bob.Expression {
{{$pkCols := $table.Constraints.Primary.Columns}}
{{$multiPK := gt (len $pkCols) 1}}
func (o *{{$tAlias.UpSingular}}) pkEQ() dialect.Expression {
return {{if $multiPK}}{{$.Dialect}}.Group({{end}}{{- range $i, $col := $pkCols -}}{{if gt $i 0}}, {{end}}{{$.Dialect}}.Quote("{{$table.Name}}", "{{$col}}"){{end}}{{if $multiPK}}){{end -}}
return {{if $multiPK}}{{$.Dialect}}.Group({{end}}{{- range $i, $col := $pkCols -}}{{if gt $i 0}}, {{end}}{{$.Dialect}}.Quote("{{$table.Key}}", "{{$col}}"){{end}}{{if $multiPK}}){{end -}}
.EQ(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error){
return o.PrimaryKeyVals().WriteSQL(ctx, w, d, start)
}))
Expand Down
2 changes: 1 addition & 1 deletion gen/templates/models/table/07_slice_methods.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (o {{$tAlias.UpSingular}}Slice) pkIN() dialect.Expression {
return {{$.Dialect}}.Raw("NULL")
}

return {{if $multiPK}}{{$.Dialect}}.Group({{end}}{{- range $i, $col := $pkCols -}}{{if gt $i 0}}, {{end}}{{$.Dialect}}.Quote("{{$table.Name}}", "{{$col}}"){{end}}{{if $multiPK}}){{end -}}
return {{if $multiPK}}{{$.Dialect}}.Group({{end}}{{- range $i, $col := $pkCols -}}{{if gt $i 0}}, {{end}}{{$.Dialect}}.Quote("{{$table.Key}}", "{{$col}}"){{end}}{{if $multiPK}}){{end -}}
.In(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error){
pkPairs := make([]bob.Expression, len(o))
for i, row := range o {
Expand Down

0 comments on commit d68dc91

Please sign in to comment.