diff --git a/cypher/convertQuery.go b/cypher/convertQuery.go index 4a5bc35e090acb70ae21e1ebda386152c32959ad..77ec5f79a9b6a81d46aaddab7fa264325ce472cf 100644 --- a/cypher/convertQuery.go +++ b/cypher/convertQuery.go @@ -66,6 +66,10 @@ func createReturnStatement(JSONQuery *entity.IncomingQueryJSON, parts entity.Que // First check to see if the return is a table (due to a groupby at the end) or if it is nodelink data numOfParts := len(parts) + if numOfParts == 0 { + return nil, errors.New("No parts found in return statement") + } + if parts[numOfParts-1].QType == "groupBy" { // Return is a table groupBy := JSONQuery.FindG(parts[numOfParts-1].QID) diff --git a/unmarshalJSON.go b/unmarshalJSON.go index 3be9df409acd5bcb5f56ba21c3a8dd5510f05ab4..919a2dfec3059d6378425365cc47660536eae84b 100644 --- a/unmarshalJSON.go +++ b/unmarshalJSON.go @@ -2,6 +2,7 @@ package query import ( "encoding/json" + "log" "git.science.uu.nl/graphpolaris/query-conversion/entity" ) @@ -14,5 +15,6 @@ UnmarshalJSON takes an incoming message and unmarshals it func UnmarshalJSON(msg *[]byte) (*entity.IncomingQueryJSON, error) { var JSONQuery entity.IncomingQueryJSON err := json.Unmarshal(*msg, &JSONQuery) + log.Println(JSONQuery) return &JSONQuery, err }