diff --git a/aql/convertQueryBenchmark_test.go b/aql/convertQueryBenchmark_test.go index b1ba7b7b6537c0a9ce571c60e5698b73967fa223..6d608cd8499b29b72913f4b9ff8d785dcbcc0b98 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 6d5a72a1d19fcfe87d4c0f614c86e5cfcff7aeeb..0abe43eb9375a17c3ebeb5fbbf51304c4c7ba839 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 cdc9891d56705ae75fbac1d28b96a95eac7799d6..0a6c8ed08fca24bbe593323320a6b7b505fcb605 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 a33e73b2d2ce1e5b6a2b95598d5e0db9b663fa34..3794ab92a7434af21c8fcc34fb640a6d1d789f3a 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 8f595f02f6a2f54a61e735f6a3aba86557fc7b67..c07a06556a6e16f92d52ffae50e7de21d0d75a70 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 e44b42e4602e8bedcf302ce5dc5248737ca57a89..b24d895f7c9afbccd519bc4c6ec3c9fecd89de9a 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 ec04a6e7e28e15a806060d4ab5cabf54def159f2..0298f8b853640178fc51c33f6056c7252e95280d 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 918738a23658e4f1b0458858d99216b230ec5c87..ba1e4b9f678b3556f359d52914814f9329fcb582 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" // } // ]