From 3a9bb64540ea04920239eaa279d4a620eee19d33 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 26 Jul 2023 08:56:34 +0800 Subject: [PATCH] Simple the code --- session_update.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/session_update.go b/session_update.go index b3640ad2..856780d8 100644 --- a/session_update.go +++ b/session_update.go @@ -151,7 +151,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6 return 0, err } - var autoCond builder.Cond + var autoCond builder.Cond = builder.NewCond() if len(condiBean) > 0 { autoCond, err = session.genAutoCond(condiBean[0]) if err != nil { @@ -159,13 +159,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6 } } else if table != nil { if col := table.DeletedColumn(); col != nil && !session.statement.GetUnscoped() { // tag "deleted" is enabled - autoCond1 := session.statement.CondDeleted(col) - - if autoCond == nil { - autoCond = autoCond1 - } else { - autoCond = autoCond.And(autoCond1) - } + autoCond = autoCond.And(session.statement.CondDeleted(col)) } }