Your Question
if I call like this :
(update(XXX).First())
it will panic:
when I debug code:
error will return in here:
stmt.Schema continue nil
it's ok so far
but here:
i think it will come in this if, call db.AddError(xxxx), but it not
so it wil panic at here:
(db.Statement.Schema is nil)
it sames like a bug?
if I call llike this :
it will achieve my purpose , get the real data after update
gorm version is :
gorm.io/gorm v1.22.3
The document you expected this should be explained
Expected answer
I think do not hang up under any circumstances
Comment From: li-jin-gou
参考一下这个文档吧 https://gorm.cn/docs/method_chaining.html
gorm v2 会复用 statment,造成条件污染,你这个case里面 statement.Model 被污染了.
Comment From: ChinaRedArmy1930
谢谢 ,学习到了