From e91228f8efbb65b323ce79ed27e1ba09c48856a7 Mon Sep 17 00:00:00 2001 From: eisbilir Date: Thu, 6 Jul 2023 15:46:06 +0300 Subject: [PATCH 1/8] feat: add returning fields --- data-access-layer/relational/relational.proto | 7 +- pom-pal.xml | 87 +++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 pom-pal.xml diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index ea6c9e7..7eee206 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -107,6 +107,7 @@ message InsertQuery { optional string id_column = 4; optional string id_sequence = 5; optional string id_table = 6; + repeated string returning_fields = 7; } message BulkInsertQuery { @@ -153,7 +154,11 @@ message RawQueryResult { } message InsertQueryResult { - uint64 last_insert_id = 1; + oneof insert_result_type { + uint64 last_insert_id = 1; + Row row = 2; + uint64 affected_rows = 3; + } } message UpdateQueryResult { diff --git a/pom-pal.xml b/pom-pal.xml new file mode 100644 index 0000000..72de48c --- /dev/null +++ b/pom-pal.xml @@ -0,0 +1,87 @@ + + + 4.0.0 + + com.topcoder + tc-dal-rdb-proto + 1.2-SNAPSHOT + + + 17 + 17 + UTF-8 + + 3.21.12 + 0.6.1 + 1.51.0 + + + + + io.grpc + grpc-stub + ${grpc.version} + + + io.grpc + grpc-protobuf + ${grpc.version} + + + jakarta.annotation + jakarta.annotation-api + 2.1.0 + true + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-plugin.version} + + + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + grpc-java + + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + ${basedir} + + data-access-layer/relational/relational.proto + + + + + + compile + compile-custom + + + + + + kr.motd.maven + os-maven-plugin + 1.7.0 + + + initialize + + detect + + + + + + + + \ No newline at end of file From 238137da9ccb10a9b013025aa303f8268398a6ef Mon Sep 17 00:00:00 2001 From: eisbilir Date: Thu, 6 Jul 2023 21:58:59 +0300 Subject: [PATCH 2/8] feat: separate modules --- pom-or.xml | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++ pom-pal.xml | 7 ++++ pom.xml | 56 ++++---------------------- 3 files changed, 127 insertions(+), 49 deletions(-) create mode 100644 pom-or.xml diff --git a/pom-or.xml b/pom-or.xml new file mode 100644 index 0000000..dee53e3 --- /dev/null +++ b/pom-or.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + + com.topcoder + tc-dal-protos + 1.0-SNAPSHOT + ./pom.xml + + + com.topcoder + tc-dal-or-sync-proto + 1.0-SNAPSHOT + + + 8 + 8 + UTF-8 + + 3.21.12 + 0.6.1 + 1.51.0 + + + + + io.grpc + grpc-stub + ${grpc.version} + + + io.grpc + grpc-protobuf + ${grpc.version} + + + jakarta.annotation + jakarta.annotation-api + 2.1.0 + true + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-plugin.version} + + + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + grpc-java + + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + ${basedir} + + domain-layer/legacy/sync.proto + domain-layer/legacy/services/sync.proto + + + + + + compile + compile-custom + + + + + + kr.motd.maven + os-maven-plugin + 1.7.0 + + + initialize + + detect + + + + + + + + + aggregate-all + + abc-codegen + stellar-codegen + abc-engine + stellar-engine + + + + aggregate-codegen + + abc-codegen + stellar-codegen + + + + + \ No newline at end of file diff --git a/pom-pal.xml b/pom-pal.xml index 72de48c..65a02f9 100644 --- a/pom-pal.xml +++ b/pom-pal.xml @@ -4,6 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + com.topcoder + tc-dal-protos + 1.0-SNAPSHOT + ./pom.xml + + com.topcoder tc-dal-rdb-proto 1.2-SNAPSHOT diff --git a/pom.xml b/pom.xml index 7141dfa..afdc21e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,14 +5,16 @@ 4.0.0 com.topcoder - tc-dal-or-sync-proto + tc-dal-protos + pom 1.0-SNAPSHOT - - 8 - 8 - UTF-8 + + pom-or.xml + pom-pal.xml + + 3.21.12 0.6.1 1.51.0 @@ -41,48 +43,4 @@ 1.3.2 - - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - ${protobuf-plugin.version} - - - com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} - grpc-java - - io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} - ${basedir} - - domain-layer/legacy/sync.proto - domain-layer/legacy/services/sync.proto - - - - - - compile - compile-custom - - - - - - kr.motd.maven - os-maven-plugin - 1.7.0 - - - initialize - - detect - - - - - - - \ No newline at end of file From 4fa968be17e7a81eeabfb8dcf7ed7e133e3cf43c Mon Sep 17 00:00:00 2001 From: eisbilir Date: Sun, 9 Jul 2023 22:53:14 +0300 Subject: [PATCH 3/8] feat: add support for nested where --- data-access-layer/relational/relational.proto | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index 7eee206..52e65db 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -63,12 +63,28 @@ message Column { optional ColumnType type = 3; } -message WhereCriteria { +message WhereCondition { Operator operator = 1; string key = 2; Value value = 3; } +message AndWhere { + repeated WhereCondition where = 1; +} + +message OrWhere { + repeated WhereCondition where = 1; +} + +message WhereCriteria { + oneof where_type { + WhereCondition condition = 1; + AndWhere and = 2; + OrWhere or =3; + } +} + message RawQuery { string query = 1; } From 5ed882f75af6cd5eb70c9497974be3ce4698b4e2 Mon Sep 17 00:00:00 2001 From: eisbilir Date: Mon, 10 Jul 2023 01:05:45 +0300 Subject: [PATCH 4/8] fix: condition group --- data-access-layer/relational/relational.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index 52e65db..13d553c 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -70,11 +70,11 @@ message WhereCondition { } message AndWhere { - repeated WhereCondition where = 1; + repeated WhereCriteria where = 1; } message OrWhere { - repeated WhereCondition where = 1; + repeated WhereCriteria where = 1; } message WhereCriteria { From 20d65a2c3675ec3717fda8bec3f28f2c357d9255 Mon Sep 17 00:00:00 2001 From: eisbilir Date: Mon, 10 Jul 2023 03:36:29 +0300 Subject: [PATCH 5/8] update field name --- data-access-layer/relational/relational.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index 13d553c..e7a7994 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -63,7 +63,7 @@ message Column { optional ColumnType type = 3; } -message WhereCondition { +message Condition { Operator operator = 1; string key = 2; Value value = 3; @@ -79,7 +79,7 @@ message OrWhere { message WhereCriteria { oneof where_type { - WhereCondition condition = 1; + Condition condition = 1; AndWhere and = 2; OrWhere or =3; } From 6206d6efb63feb66b91440510f66f015c4bbe08d Mon Sep 17 00:00:00 2001 From: eisbilir Date: Tue, 11 Jul 2023 17:40:10 +0300 Subject: [PATCH 6/8] feat: update column --- data-access-layer/relational/relational.proto | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index e7a7994..db4c512 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -58,14 +58,15 @@ message Value { } message Column { - optional string table_name = 1; - string name = 2; - optional ColumnType type = 3; + optional string schema = 1; + string table_name = 2; + string name = 3; + ColumnType type = 4; } message Condition { Operator operator = 1; - string key = 2; + Column key = 2; Value value = 3; } From 82c64a5ebc7f3a2e4c585d55d74b5bec735920df Mon Sep 17 00:00:00 2001 From: eisbilir Date: Wed, 12 Jul 2023 01:39:15 +0300 Subject: [PATCH 7/8] feat: add join --- data-access-layer/relational/relational.proto | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index db4c512..f20535f 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -57,13 +57,24 @@ message Value { } } -message Column { - optional string schema = 1; +message TypedColumn { + string schema = 1; string table_name = 2; string name = 3; ColumnType type = 4; } +message Column { + string schema = 1; + string table_name = 2; + string name = 3; +} + +message ReturningColumn { + string name = 1; + ColumnType type = 2; +} + message Condition { Operator operator = 1; Column key = 2; @@ -90,23 +101,33 @@ message RawQuery { string query = 1; } +message Table { + string schema = 1; + string table_name = 2; +} + +message JoinCondition { + Operator operator = 1; + Column left = 2; + oneof right { + Value value = 3; + Column column = 4; + } +} + message Join { JoinType type = 1; - optional string from_table_schema = 2; - optional string join_table_schema = 3; - string from_table = 4; - string join_table = 5; - string from_column = 6; - string join_column = 7; + Table table = 2; + repeated JoinCondition conditions = 3; } message SelectQuery { - optional string schema = 1; + string schema = 1; string table = 2; - repeated Column column = 3; + repeated TypedColumn column = 3; repeated WhereCriteria where = 4; - repeated string group_by = 5; - repeated string order_by = 6; + repeated Column group_by = 5; + repeated Column order_by = 6; repeated Join join = 7; uint32 limit = 8; uint32 offset = 9; @@ -118,13 +139,13 @@ message ColumnValue { } message InsertQuery { - optional string schema = 1; + string schema = 1; string table = 2; repeated ColumnValue column_value = 3; optional string id_column = 4; optional string id_sequence = 5; optional string id_table = 6; - repeated string returning_fields = 7; + repeated ReturningColumn returning_fields = 7; } message BulkInsertQuery { @@ -132,14 +153,14 @@ message BulkInsertQuery { } message UpdateQuery { - optional string schema = 1; + string schema = 1; string table = 2; repeated ColumnValue column_value = 3; repeated WhereCriteria where = 4; } message DeleteQuery { - optional string schema = 1; + string schema = 1; string table = 2; repeated WhereCriteria where = 3; } From ba54ae4773aa0df5727be13665a37022ed49bc33 Mon Sep 17 00:00:00 2001 From: eisbilir Date: Wed, 12 Jul 2023 18:06:12 +0300 Subject: [PATCH 8/8] feat: add where in, update column --- data-access-layer/relational/relational.proto | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/data-access-layer/relational/relational.proto b/data-access-layer/relational/relational.proto index f20535f..4b545b9 100644 --- a/data-access-layer/relational/relational.proto +++ b/data-access-layer/relational/relational.proto @@ -61,7 +61,8 @@ message TypedColumn { string schema = 1; string table_name = 2; string name = 3; - ColumnType type = 4; + optional string alias = 4; + ColumnType type = 5; } message Column { @@ -72,13 +73,14 @@ message Column { message ReturningColumn { string name = 1; - ColumnType type = 2; + optional string alias = 2; + ColumnType type = 3; } message Condition { Operator operator = 1; Column key = 2; - Value value = 3; + repeated Value value = 3; } message AndWhere {