This commit is contained in:
+6
-2
@@ -27,8 +27,12 @@ type Change struct {
|
||||
|
||||
// AddObject adds the model into the appropriate array.
|
||||
func (change *Change) AddObject(object interface{}) bool {
|
||||
if v := reflect.ValueOf(object); v.Kind() != reflect.Ptr && v.Kind() != reflect.Slice {
|
||||
return change.AddObject(v.Addr().Interface())
|
||||
if v := reflect.ValueOf(object); v.Kind() == reflect.Struct {
|
||||
ptr := reflect.PtrTo(v.Type())
|
||||
ptrValue := reflect.New(ptr.Elem())
|
||||
ptrValue.Elem().Set(v)
|
||||
|
||||
object = ptrValue.Interface()
|
||||
}
|
||||
|
||||
switch object := object.(type) {
|
||||
|
||||
Reference in New Issue
Block a user