From 46ad1de9a3c57257d9b1f085f9c7f492abbff004 Mon Sep 17 00:00:00 2001
From: Fjodor <fjodor_rs@hotmail.com>
Date: Mon, 14 Jun 2021 11:44:40 +0200
Subject: [PATCH] refactored text -> string, number -> int

---
 aql/convertQueryBenchmark_test.go    | 10 +++----
 aql/convertQuery_test.go             | 44 ++++++++++++++--------------
 aql/createConstraints.go             |  8 ++---
 cypher/convertQueryBenchmark_test.go | 10 +++----
 cypher/convertQuery_test.go          | 44 ++++++++++++++--------------
 cypher/createConstraints.go          |  8 ++---
 entity/queryStruct.go                |  4 +--
 main/main.go                         | 10 +++----
 8 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/aql/convertQueryBenchmark_test.go b/aql/convertQueryBenchmark_test.go
index b1ba7b7..6d608cd 100644
--- a/aql/convertQueryBenchmark_test.go
+++ b/aql/convertQueryBenchmark_test.go
@@ -52,7 +52,7 @@ func BenchmarkConvertOneAttributeQuery(b *testing.B) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -97,7 +97,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "city",
 						"value": "New York",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -108,7 +108,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -119,7 +119,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -138,7 +138,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
diff --git a/aql/convertQuery_test.go b/aql/convertQuery_test.go
index 6d5a72a..0abe43e 100644
--- a/aql/convertQuery_test.go
+++ b/aql/convertQuery_test.go
@@ -61,7 +61,7 @@ func TestEntityOneAttributeQuery(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -108,7 +108,7 @@ func TestRelationWithConstraint(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -127,7 +127,7 @@ func TestRelationWithConstraint(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -171,7 +171,7 @@ func TestModifierCountEntity(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -223,7 +223,7 @@ func TestModifierCountEntityAttribute(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -277,7 +277,7 @@ func TestModifierCountRelation(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -296,7 +296,7 @@ func TestModifierCountRelation(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -349,7 +349,7 @@ func TestModifierCountRelationAttribute(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -368,7 +368,7 @@ func TestModifierCountRelationAttribute(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -423,7 +423,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -434,7 +434,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -453,7 +453,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -502,7 +502,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "city",
 						"value": "New York",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -513,7 +513,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -524,7 +524,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -543,7 +543,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -599,7 +599,7 @@ func TestRelationWithOnlyToNode(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -659,7 +659,7 @@ func TestTooManyReturnEntities(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -713,7 +713,7 @@ func TestTooManyReturnRelations(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -768,7 +768,7 @@ func TestNegativeReturnEntities(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -817,7 +817,7 @@ func TestNoRelationsField(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -863,7 +863,7 @@ func TestEntityFromLowerThanNegativeOneInRelation(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
diff --git a/aql/createConstraints.go b/aql/createConstraints.go
index cdc9891..0a6c8ed 100644
--- a/aql/createConstraints.go
+++ b/aql/createConstraints.go
@@ -46,12 +46,12 @@ func createConstraintBoolExpression(constraint *entity.QueryConstraintStruct, na
 	)
 
 	// Constraint datatypes back end
-	// text		  MatchTypes: EQ/NEQ/contains/excludes
-	// number     MatchTypes: EQ/NEQ/GT/LT/GET/LET
+	// string		  MatchTypes: EQ/NEQ/contains/excludes
+	// int     MatchTypes: EQ/NEQ/GT/LT/GET/LET
 	// bool       MatchTypes: EQ/NEQ
 
 	switch constraint.DataType {
-	case "text":
+	case "string":
 		value = fmt.Sprintf("\"%s\"", constraint.Value)
 		switch constraint.MatchType {
 		case "NEQ":
@@ -65,7 +65,7 @@ func createConstraintBoolExpression(constraint *entity.QueryConstraintStruct, na
 		default: //EQ
 			match = "=="
 		}
-	case "number":
+	case "int":
 		value = constraint.Value
 		switch constraint.MatchType {
 		case "NEQ":
diff --git a/cypher/convertQueryBenchmark_test.go b/cypher/convertQueryBenchmark_test.go
index a33e73b..3794ab9 100644
--- a/cypher/convertQueryBenchmark_test.go
+++ b/cypher/convertQueryBenchmark_test.go
@@ -52,7 +52,7 @@ func BenchmarkConvertOneAttributeQuery(b *testing.B) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -97,7 +97,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "city",
 						"value": "New York",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -108,7 +108,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -119,7 +119,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -138,7 +138,7 @@ func BenchmarkConvertTwoRelationQuery(b *testing.B) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
diff --git a/cypher/convertQuery_test.go b/cypher/convertQuery_test.go
index 8f595f0..c07a065 100644
--- a/cypher/convertQuery_test.go
+++ b/cypher/convertQuery_test.go
@@ -58,7 +58,7 @@ func TestEntityOneAttributeQuery(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -105,7 +105,7 @@ func TestRelationWithConstraint(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -124,7 +124,7 @@ func TestRelationWithConstraint(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -168,7 +168,7 @@ func TestRelationWithConstraint(t *testing.T) {
 // 					{
 // 						"attribute": "state",
 // 						"value": "HI",
-// 						"dataType": "text",
+// 						"dataType": "string",
 // 						"matchType": "exact"
 // 					}
 // 				]
@@ -221,7 +221,7 @@ func TestRelationWithConstraint(t *testing.T) {
 // 					{
 // 						"attribute": "state",
 // 						"value": "HI",
-// 						"dataType": "text",
+// 						"dataType": "string",
 // 						"matchType": "exact"
 // 					}
 // 				]
@@ -276,7 +276,7 @@ func TestRelationWithConstraint(t *testing.T) {
 // 					{
 // 						"attribute": "state",
 // 						"value": "HI",
-// 						"dataType": "text",
+// 						"dataType": "string",
 // 						"matchType": "exact"
 // 					}
 // 				]
@@ -295,7 +295,7 @@ func TestRelationWithConstraint(t *testing.T) {
 // 					{
 // 						"attribute": "Day",
 // 						"value": "15",
-// 						"dataType": "number",
+// 						"dataType": "int",
 // 						"matchType": "EQ"
 // 					}
 // 				]
@@ -348,7 +348,7 @@ func TestRelationWithConstraint(t *testing.T) {
 // 					{
 // 						"attribute": "state",
 // 						"value": "HI",
-// 						"dataType": "text",
+// 						"dataType": "string",
 // 						"matchType": "exact"
 // 					}
 // 				]
@@ -367,7 +367,7 @@ func TestRelationWithConstraint(t *testing.T) {
 // 					{
 // 						"attribute": "Day",
 // 						"value": "15",
-// 						"dataType": "number",
+// 						"dataType": "int",
 // 						"matchType": "EQ"
 // 					}
 // 				]
@@ -422,7 +422,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -433,7 +433,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -452,7 +452,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -501,7 +501,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "city",
 						"value": "New York",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -512,7 +512,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -523,7 +523,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "state",
 						"value": "HI",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -542,7 +542,7 @@ func TestTwoRelations(t *testing.T) {
 					{
 						"attribute": "Day",
 						"value": "15",
-						"dataType": "number",
+						"dataType": "int",
 						"matchType": "EQ"
 					}
 				]
@@ -598,7 +598,7 @@ func TestRelationWithOnlyToNode(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -658,7 +658,7 @@ func TestTooManyReturnEntities(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -712,7 +712,7 @@ func TestTooManyReturnRelations(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -767,7 +767,7 @@ func TestNegativeReturnEntities(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -816,7 +816,7 @@ func TestNoRelationsField(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
@@ -862,7 +862,7 @@ func TestEntityFromLowerThanNegativeOneInRelation(t *testing.T) {
 						{
 							"attribute": "city",
 							"value": "San Francisco",
-							"dataType": "text",
+							"dataType": "string",
 							"matchType": "exact"
 						}
 					]
diff --git a/cypher/createConstraints.go b/cypher/createConstraints.go
index e44b42e..b24d895 100644
--- a/cypher/createConstraints.go
+++ b/cypher/createConstraints.go
@@ -47,14 +47,14 @@ func createConstraintBoolExpression(constraint *entity.QueryConstraintStruct, na
 	)
 
 	// Constraint datatypes back end
-	// text		  MatchTypes: EQ/NEQ/contains/excludes
-	// number     MatchTypes: EQ/NEQ/GT/LT/GET/LET
+	// string		  MatchTypes: EQ/NEQ/contains/excludes
+	// int     MatchTypes: EQ/NEQ/GT/LT/GET/LET
 	// bool       MatchTypes: EQ/NEQ
 
 	neq = ""
 
 	switch constraint.DataType {
-	case "text":
+	case "string":
 		value = fmt.Sprintf("\"%s\"", constraint.Value)
 		switch constraint.MatchType {
 		case "NEQ":
@@ -69,7 +69,7 @@ func createConstraintBoolExpression(constraint *entity.QueryConstraintStruct, na
 		default: //EQ
 			match = "="
 		}
-	case "number":
+	case "int":
 		value = constraint.Value
 		switch constraint.MatchType {
 		case "NEQ":
diff --git a/entity/queryStruct.go b/entity/queryStruct.go
index ec04a6e..0298f8b 100644
--- a/entity/queryStruct.go
+++ b/entity/queryStruct.go
@@ -49,8 +49,8 @@ type QuerySearchDepthStruct struct {
 
 // QueryConstraintStruct holds the information of the constraint
 // Constraint datatypes
-// 	text     MatchTypes: exact/contains/startswith/endswith
-// 	number   MatchTypes: GT/LT/EQ
+// 	string     MatchTypes: exact/contains/startswith/endswith
+// 	int   MatchTypes: GT/LT/EQ
 // 	bool     MatchTypes: EQ/NEQ
 type QueryConstraintStruct struct {
 	Attribute string
diff --git a/main/main.go b/main/main.go
index 918738a..ba1e4b9 100644
--- a/main/main.go
+++ b/main/main.go
@@ -24,7 +24,7 @@ func main() {
 					{
 						"attribute": "city",
 						"value": "San Francisco",
-						"dataType": "text",
+						"dataType": "string",
 						"matchType": "exact"
 					}
 				]
@@ -52,7 +52,7 @@ func main() {
 	// 				{
 	// 					"attribute": "city",
 	// 					"value": "New York",
-	// 					"dataType": "text",
+	// 					"dataType": "string",
 	// 					"matchType": "exact"
 	// 				}
 	// 			]
@@ -63,7 +63,7 @@ func main() {
 	// 				{
 	// 					"attribute": "city",
 	// 					"value": "San Francisco",
-	// 					"dataType": "text",
+	// 					"dataType": "string",
 	// 					"matchType": "exact"
 	// 				}
 	// 			]
@@ -74,7 +74,7 @@ func main() {
 	// 				{
 	// 					"attribute": "state",
 	// 					"value": "HI",
-	// 					"dataType": "text",
+	// 					"dataType": "string",
 	// 					"matchType": "exact"
 	// 				}
 	// 			]
@@ -93,7 +93,7 @@ func main() {
 	// 				{
 	// 					"attribute": "Day",
 	// 					"value": "15",
-	// 					"dataType": "number",
+	// 					"dataType": "int",
 	// 					"matchType": "EQ"
 	// 				}
 	// 			]
-- 
GitLab