Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

更新 engine CondDeleted 函数的实现 #1229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ func (engine *Engine) BufferSize(size int) *Session {

// CondDeleted returns the conditions whether a record is soft deleted.
func (engine *Engine) CondDeleted(colName string) builder.Cond {
if engine.dialect.DBType() == core.MSSQL {
switch engine.dialect.DBType() {
case core.MSSQL:
return builder.IsNull{colName}
case core.POSTGRES:
return builder.IsNull{colName}
default:
return builder.IsNull{colName}.Or(builder.Eq{colName: zeroTime1})
}
return builder.IsNull{colName}.Or(builder.Eq{colName: zeroTime1})
}

// ShowSQL show SQL statement or not on logger if log level is great than INFO
Expand Down