Skip to content

Commit 179760d

Browse files
authored
Merge pull request go-gorm#2722 from kohago/master
Add warning comment
2 parents 2586a05 + e359fee commit 179760d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ func (s *DB) FirstOrCreate(out interface{}, where ...interface{}) *DB {
434434
}
435435

436436
// Update update attributes with callbacks, refer: https://jinzhu.github.io/gorm/crud.html#update
437+
// WARNING when update with struct, GORM will not update fields that with zero value
437438
func (s *DB) Update(attrs ...interface{}) *DB {
438439
return s.Updates(toSearchableMap(attrs...), true)
439440
}
@@ -480,6 +481,7 @@ func (s *DB) Create(value interface{}) *DB {
480481
}
481482

482483
// Delete delete value match given conditions, if the value has primary key, then will including the primary key as condition
484+
// WARNING If model has DeletedAt field, GORM will only set field DeletedAt's value to current time
483485
func (s *DB) Delete(value interface{}, where ...interface{}) *DB {
484486
return s.NewScope(value).inlineCondition(where...).callCallbacks(s.parent.callbacks.deletes).db
485487
}

0 commit comments

Comments
 (0)