simplification, whitespace

This commit is contained in:
Sam Woodard 2015-07-10 08:30:59 -07:00
parent 97cf7cfca4
commit d8d9d87573
1 changed files with 3 additions and 4 deletions

View File

@ -124,25 +124,24 @@ func unmarshalJsonApiNode(data *JsonApiNode, model reflect.Value) error {
if isSlice {
data := relationship["data"].([]interface{})
models := reflect.New(fieldValue.Type()).Elem()
for _, r := range data {
m := reflect.New(fieldValue.Type().Elem().Elem())
h := r.(map[string]interface{})
if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil {
er = err
return false
}
models = reflect.Append(models, m)
}
fieldValue.Set(models)
} else {
data := relationship["data"].(interface{})
m := reflect.New(fieldValue.Type().Elem())
h := data.(map[string]interface{})
h := relationship["data"].(map[string]interface{})
if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil {
er = err