forked from mirror/gorm
Fix exception for FirstOrCreate when search condition is nil
This commit is contained in:
parent
6c5b95e2b2
commit
1c1df2318c
2
main.go
2
main.go
|
@ -185,7 +185,7 @@ func (s *DB) FirstOrCreate(out interface{}, where ...interface{}) *DB {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
c.NewScope(out).inlineCondition(where...).initialize().callCallbacks(s.parent.callback.creates)
|
c.NewScope(out).inlineCondition(where...).initialize().callCallbacks(s.parent.callback.creates)
|
||||||
} else if len(s.search.AssignAttrs) > 0 {
|
} else if len(c.search.AssignAttrs) > 0 {
|
||||||
c.NewScope(out).Set("gorm:update_interface", s.search.AssignAttrs).callCallbacks(s.parent.callback.updates)
|
c.NewScope(out).Set("gorm:update_interface", s.search.AssignAttrs).callCallbacks(s.parent.callback.updates)
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
|
|
Loading…
Reference in New Issue