From 241c671aab51ac4b23f597f051b15b2dbab8ddef Mon Sep 17 00:00:00 2001 From: thijsheijden <hi@thijsheijden.nl> Date: Tue, 18 May 2021 10:54:25 +0200 Subject: [PATCH] Re-added the incoming JSON format --- internal/entity/JSONQuery.go | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 internal/entity/JSONQuery.go diff --git a/internal/entity/JSONQuery.go b/internal/entity/JSONQuery.go new file mode 100644 index 0000000..ec04a6e --- /dev/null +++ b/internal/entity/JSONQuery.go @@ -0,0 +1,60 @@ +package entity + +// IncomingQueryJSON describes the query coming into the service in JSON format +type IncomingQueryJSON struct { + DatabaseName string + Return QueryReturnStruct + Entities []QueryEntityStruct + Relations []QueryRelationStruct + // Limit is for limiting the amount of paths AQL will return in a relation let statement + Limit int + Modifiers []QueryModifierStruct +} + +// QueryReturnStruct holds the indices of the entities and relations that need to be returned +type QueryReturnStruct struct { + Entities []int + Relations []int + //Modifiers []int +} + +// QueryEntityStruct encapsulates a single entity with its corresponding constraints +type QueryEntityStruct struct { + Type string + Constraints []QueryConstraintStruct +} + +// QueryRelationStruct encapsulates a single relation with its corresponding constraints +type QueryRelationStruct struct { + Type string + EntityFrom int + EntityTo int + Depth QuerySearchDepthStruct + Constraints []QueryConstraintStruct +} + +// QueryModifierStruct encapsulates a single modifier with its corresponding constraints +type QueryModifierStruct struct { + Type string // SUM COUNT AVG + SelectedType string // node relation + ID int // ID of the enitity or relation + AttributeIndex int // = -1 if its the node or relation, = > -1 if an attribute is selected +} + +// QuerySearchDepthStruct holds the range of traversals for the relation +type QuerySearchDepthStruct struct { + Min int + Max int +} + +// QueryConstraintStruct holds the information of the constraint +// Constraint datatypes +// text MatchTypes: exact/contains/startswith/endswith +// number MatchTypes: GT/LT/EQ +// bool MatchTypes: EQ/NEQ +type QueryConstraintStruct struct { + Attribute string + Value string + DataType string + MatchType string +} -- GitLab