From 43735ce73f3644d6c5ac596cb2dc339f89439deb Mon Sep 17 00:00:00 2001 From: Joris <joris.l@hotmail.com> Date: Wed, 24 Nov 2021 12:43:01 +0100 Subject: [PATCH] logstatement added --- cypher/convertQuery.go | 4 ++++ unmarshalJSON.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cypher/convertQuery.go b/cypher/convertQuery.go index 4a5bc35..77ec5f7 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 3be9df4..919a2df 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 } -- GitLab