mirror of https://github.com/go-gorm/gorm.git
Support double ptr for Save
This commit is contained in:
parent
81c4024232
commit
0729261b62
|
@ -74,6 +74,10 @@ func (db *DB) Save(value interface{}) (tx *DB) {
|
||||||
tx.Statement.Dest = value
|
tx.Statement.Dest = value
|
||||||
|
|
||||||
reflectValue := reflect.Indirect(reflect.ValueOf(value))
|
reflectValue := reflect.Indirect(reflect.ValueOf(value))
|
||||||
|
for reflectValue.Kind() == reflect.Ptr || reflectValue.Kind() == reflect.Interface {
|
||||||
|
reflectValue = reflect.Indirect(reflectValue)
|
||||||
|
}
|
||||||
|
|
||||||
switch reflectValue.Kind() {
|
switch reflectValue.Kind() {
|
||||||
case reflect.Slice, reflect.Array:
|
case reflect.Slice, reflect.Array:
|
||||||
if _, ok := tx.Statement.Clauses["ON CONFLICT"]; !ok {
|
if _, ok := tx.Statement.Clauses["ON CONFLICT"]; !ok {
|
||||||
|
|
Loading…
Reference in New Issue