Fix duplicated soft delete clause

This commit is contained in:
Jinzhu 2020-09-01 18:05:26 +08:00
parent e73147fa8e
commit bf6123b01e
1 changed files with 1 additions and 8 deletions

View File

@ -25,14 +25,7 @@ func (n DeletedAt) Value() (driver.Value, error) {
} }
func (DeletedAt) QueryClauses(f *schema.Field) []clause.Interface { func (DeletedAt) QueryClauses(f *schema.Field) []clause.Interface {
return []clause.Interface{ return []clause.Interface{SoftDeleteQueryClause{Field: f}}
clause.Where{Exprs: []clause.Expression{
clause.Eq{
Column: clause.Column{Table: clause.CurrentTable, Name: f.DBName},
Value: nil,
},
}},
}
} }
type SoftDeleteQueryClause struct { type SoftDeleteQueryClause struct {