Skip to content

Commit

Permalink
Merge pull request go-gorm#2722 from kohago/master
Browse files Browse the repository at this point in the history
Add warning comment
  • Loading branch information
emirb authored Oct 28, 2019
2 parents 2586a05 + e359fee commit 179760d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ func (s *DB) FirstOrCreate(out interface{}, where ...interface{}) *DB {
}

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

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

0 comments on commit 179760d

Please sign in to comment.