Skip to content

Commit

Permalink
Clean up logic in tryParseAsGeo. (#3672)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Jul 23, 2019
1 parent b324ed8 commit 98d3f02
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions chunker/json/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,17 @@ func handleGeoType(val map[string]interface{}, nq *api.NQuad) (bool, error) {
func tryParseAsGeo(b []byte, nq *api.NQuad) (bool, error) {
var g geom.T
err := geojson.Unmarshal(b, &g)
if err == nil {
geo, err := types.ObjectValue(types.GeoID, g)
if err != nil {
return false, errors.Errorf("Couldn't convert value: %s to geo type", string(b))
}
if err != nil {
return false, nil
}

nq.ObjectValue = geo
return true, nil
geo, err := types.ObjectValue(types.GeoID, g)
if err != nil {
return false, errors.Errorf("Couldn't convert value: %s to geo type", string(b))
}
return false, nil

nq.ObjectValue = geo
return true, nil
}

// TODO - Abstract these parameters to a struct.
Expand Down

0 comments on commit 98d3f02

Please sign in to comment.