forked from Mirrors/jsonapi
simplification, whitespace
This commit is contained in:
parent
97cf7cfca4
commit
d8d9d87573
|
@ -124,25 +124,24 @@ func unmarshalJsonApiNode(data *JsonApiNode, model reflect.Value) error {
|
||||||
|
|
||||||
if isSlice {
|
if isSlice {
|
||||||
data := relationship["data"].([]interface{})
|
data := relationship["data"].([]interface{})
|
||||||
|
|
||||||
models := reflect.New(fieldValue.Type()).Elem()
|
models := reflect.New(fieldValue.Type()).Elem()
|
||||||
|
|
||||||
for _, r := range data {
|
for _, r := range data {
|
||||||
m := reflect.New(fieldValue.Type().Elem().Elem())
|
m := reflect.New(fieldValue.Type().Elem().Elem())
|
||||||
h := r.(map[string]interface{})
|
h := r.(map[string]interface{})
|
||||||
|
|
||||||
if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil {
|
if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil {
|
||||||
er = err
|
er = err
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
models = reflect.Append(models, m)
|
models = reflect.Append(models, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldValue.Set(models)
|
fieldValue.Set(models)
|
||||||
} else {
|
} else {
|
||||||
data := relationship["data"].(interface{})
|
|
||||||
|
|
||||||
m := reflect.New(fieldValue.Type().Elem())
|
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 {
|
if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil {
|
||||||
er = err
|
er = err
|
||||||
|
|
Loading…
Reference in New Issue