From 0a33817aaacf44f0091d1bc437728cb57a591bf9 Mon Sep 17 00:00:00 2001 From: Joris <j.r.j.lelieveld@students.uu.nl> Date: Wed, 26 May 2021 20:18:54 +0200 Subject: [PATCH] With statement hotfix --- aql/convertQuery.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aql/convertQuery.go b/aql/convertQuery.go index 5d529b7..9e17331 100644 --- a/aql/convertQuery.go +++ b/aql/convertQuery.go @@ -16,28 +16,28 @@ func (s *Service) ConvertQuery(JSONQuery *entity.IncomingQueryJSON) (*string, er // Check to make sure all indexes exist // The largest possible id for an entity - largestEntityId := len(JSONQuery.Entities) - 1 + largestEntityID := len(JSONQuery.Entities) - 1 // The largest possible id for a relation - largestRelationId := len(JSONQuery.Relations) - 1 + largestRelationID := len(JSONQuery.Relations) - 1 // Make sure no entity should be returned that is outside the range of that list for _, e := range JSONQuery.Return.Entities { // If this entity references an entity that is outside the range - if e > largestEntityId || e < 0 { + if e > largestEntityID || e < 0 { return nil, errors.New("non-existing entity referenced in return") } } // Make sure that no relation mentions a non-existing entity for _, r := range JSONQuery.Relations { - if r.EntityFrom > largestEntityId || r.EntityTo > largestEntityId { + if r.EntityFrom > largestEntityID || r.EntityTo > largestEntityID { return nil, errors.New("non-exisiting entity referenced in relation") } } // Make sure no non-existing relation is tried to be returned for _, r := range JSONQuery.Return.Relations { - if r > largestRelationId || r < 0 { + if r > largestRelationID || r < 0 { return nil, errors.New("non-existing relation referenced in return") } } @@ -253,7 +253,7 @@ func createRelationLetWithFromEntity(relation *entity.QueryRelationStruct, name // Add a WITH statement if the collection of entityTo is not yet included if (*entities)[(*relation).EntityFrom].Type != (*entities)[(*relation).EntityTo].Type { - header = fmt.Sprintf("WITH %v\n %v", (*entities)[(*relation).EntityTo].Type, header) + header = fmt.Sprintf("%v\n\tWITH %v", header, (*entities)[(*relation).EntityTo].Type) } } -- GitLab