Generic Select statement in Reload
This commit is contained in:
parent
f913d5e791
commit
b2acda8ade
1 changed files with 1 additions and 15 deletions
|
@ -79,22 +79,8 @@ func (o *{{$tableNameSingular}}Slice) ReloadAll(exec boil.Executor) error {
|
|||
args = append(args, pkeyArgs...)
|
||||
}
|
||||
|
||||
{{if ne .DriverName "mssql" -}}
|
||||
sql := fmt.Sprintf(
|
||||
"SELECT {{$schemaTable}}.* FROM {{$schemaTable}} WHERE (%s) IN (%s)",
|
||||
strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, {{$varNameSingular}}PrimaryKeyColumns), ","),
|
||||
strmangle.Placeholders(dialect.IndexPlaceholders, len(*o) * len({{$varNameSingular}}PrimaryKeyColumns), 1, len({{$varNameSingular}}PrimaryKeyColumns)),
|
||||
)
|
||||
{{- else -}}
|
||||
startIndex := 1
|
||||
|
||||
if !dialect.IndexPlaceholders {
|
||||
startIndex = 0
|
||||
}
|
||||
|
||||
sql := "SELECT {{$schemaTable}}.* FROM {{$schemaTable}} WHERE " +
|
||||
strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), startIndex, {{$varNameSingular}}PrimaryKeyColumns, len(*o))
|
||||
{{- end}}
|
||||
strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), {{if .Dialect.IndexPlaceholders}}1{{else}}0{{end}}, {{$varNameSingular}}PrimaryKeyColumns, len(*o))
|
||||
|
||||
q := queries.Raw(exec, sql, args...)
|
||||
|
||||
|
|
Loading…
Reference in a new issue