Skip to content

Commit

Permalink
Remove else clause (PR request)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Apr 19, 2022
1 parent ced4c83 commit 4468f07
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions query/graphql/planner/sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,27 @@ func (p *Planner) getSourceField(
fmt.Errorf("Unable to find field description for field: %s", sourceProperty)
}
return fieldDescription, nil
} else {
parentFieldDescription, parentFieldDescriptionFound := sourceInfo.collectionDescription.GetField(sourceCollection)
if !parentFieldDescriptionFound {
return client.FieldDescription{}, fmt.Errorf(
"Unable to find parent field description for field: %s",
sourceCollection,
)
}
collectionDescription, err := p.getCollectionDesc(parentFieldDescription.Schema)
if err != nil {
return client.FieldDescription{}, err
}
fieldDescription, fieldDescriptionFound := collectionDescription.GetField(sourceProperty)
if !fieldDescriptionFound {
return client.FieldDescription{},
fmt.Errorf("Unable to find child field description for field: %s", sourceProperty)
}
return fieldDescription, nil
}

parentFieldDescription, parentFieldDescriptionFound := sourceInfo.collectionDescription.GetField(sourceCollection)
if !parentFieldDescriptionFound {
return client.FieldDescription{}, fmt.Errorf(
"Unable to find parent field description for field: %s",
sourceCollection,
)
}

collectionDescription, err := p.getCollectionDesc(parentFieldDescription.Schema)
if err != nil {
return client.FieldDescription{}, err
}

fieldDescription, fieldDescriptionFound := collectionDescription.GetField(sourceProperty)
if !fieldDescriptionFound {
return client.FieldDescription{},
fmt.Errorf("Unable to find child field description for field: %s", sourceProperty)
}
return fieldDescription, nil
}
return client.FieldDescription{}, fmt.Errorf("Unable to determine sum type.")
}
Expand Down

0 comments on commit 4468f07

Please sign in to comment.