before Update nil point panic
This commit is contained in:
parent
f07e779830
commit
c90013c901
@ -31,9 +31,9 @@ func SetupUpdateReflectValue(db *gorm.DB) {
|
|||||||
|
|
||||||
// BeforeUpdate before update hooks
|
// BeforeUpdate before update hooks
|
||||||
func BeforeUpdate(db *gorm.DB) {
|
func BeforeUpdate(db *gorm.DB) {
|
||||||
if !db.Statement.ReflectValue.CanAddr() {
|
//if !db.Statement.ReflectValue.CanAddr() {
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
|
|
||||||
if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeUpdate) {
|
if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeUpdate) {
|
||||||
callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
|
callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user