mirror of https://github.com/go-gorm/gorm.git
don't reuse modifier, use table name instead
This commit is contained in:
parent
a1d9d7dc18
commit
c380166ff5
|
@ -132,7 +132,7 @@ func Delete(config *Config) func(db *gorm.DB) {
|
||||||
HandleJoins(
|
HandleJoins(
|
||||||
db,
|
db,
|
||||||
func(db *gorm.DB) {
|
func(db *gorm.DB) {
|
||||||
deleteClause.Modifier = db.Statement.Table
|
deleteClause.Table = db.Statement.Table
|
||||||
},
|
},
|
||||||
func(db *gorm.DB, tableAliasName string, idx int, relation *schema.Relationship) {
|
func(db *gorm.DB, tableAliasName string, idx int, relation *schema.Relationship) {
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,6 +2,7 @@ package clause
|
||||||
|
|
||||||
type Delete struct {
|
type Delete struct {
|
||||||
Modifier string
|
Modifier string
|
||||||
|
Table string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Delete) Name() string {
|
func (d Delete) Name() string {
|
||||||
|
@ -13,7 +14,11 @@ func (d Delete) Build(builder Builder) {
|
||||||
|
|
||||||
if d.Modifier != "" {
|
if d.Modifier != "" {
|
||||||
builder.WriteByte(' ')
|
builder.WriteByte(' ')
|
||||||
builder.WriteQuoted(d.Modifier)
|
builder.WriteString(d.Modifier)
|
||||||
|
}
|
||||||
|
if d.Table != "" {
|
||||||
|
builder.WriteByte(' ')
|
||||||
|
builder.WriteQuoted(d.Table)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue