Generic Delete statement
This commit is contained in:
parent
178d925c24
commit
f913d5e791
1 changed files with 2 additions and 16 deletions
|
@ -135,22 +135,8 @@ func (o {{$tableNameSingular}}Slice) DeleteAll(exec boil.Executor) error {
|
|||
args = append(args, pkeyArgs...)
|
||||
}
|
||||
|
||||
{{if ne .DriverName "mssql" -}}
|
||||
sql := fmt.Sprintf(
|
||||
"DELETE 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 := "DELETE FROM {{$schemaTable}} WHERE " +
|
||||
strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), startIndex, {{$varNameSingular}}PrimaryKeyColumns, len(o))
|
||||
{{- end}}
|
||||
sql := "DELETE FROM {{$schemaTable}} WHERE " +
|
||||
strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), {{if .Dialect.IndexPlaceholders}}1{{else}}0{{end}}, {{$varNameSingular}}PrimaryKeyColumns, len(o))
|
||||
|
||||
if boil.DebugMode {
|
||||
fmt.Fprintln(boil.DebugWriter, sql)
|
||||
|
|
Loading…
Add table
Reference in a new issue