diff --git a/quesma/Dockerfile b/quesma/Dockerfile index 286af0354..983ff673d 100644 --- a/quesma/Dockerfile +++ b/quesma/Dockerfile @@ -2,6 +2,9 @@ FROM golang:alpine AS builder WORKDIR /quesma +## v2 is a seprate module, not package +COPY v2/go.mod v2/go.mod +COPY v2/go.sum v2/go.sum COPY go.mod go.sum ./ diff --git a/quesma/go.mod b/quesma/go.mod index e874c7662..8f21a8f40 100644 --- a/quesma/go.mod +++ b/quesma/go.mod @@ -2,12 +2,15 @@ module quesma go 1.23.2 +replace quesma_v2 => ./v2 + require ( github.com/ClickHouse/clickhouse-go/v2 v2.30.0 github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/DataDog/go-sqllexer v0.0.17 github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df github.com/coreos/go-semver v0.3.1 + github.com/goccy/go-json v0.10.3 github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 github.com/gorilla/securecookie v1.1.2 @@ -25,14 +28,15 @@ require ( github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a github.com/tidwall/sjson v1.2.5 github.com/ucarion/urlpath v0.0.0-20200424170820-7ccc79b76bbb - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 + golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f golang.org/x/oauth2 v0.24.0 + quesma_v2 v0.0.0-00010101000000-000000000000 ) require ( github.com/go-viper/mapstructure/v2 v2.2.1 // indirect - github.com/goccy/go-json v0.10.3 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/jackc/pgx/v5 v5.7.1 // indirect github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/quesma/go.sum b/quesma/go.sum index 9c539f313..6bb29df6e 100644 --- a/quesma/go.sum +++ b/quesma/go.sum @@ -57,6 +57,12 @@ github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/U github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs= +github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40= @@ -111,8 +117,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -168,8 +174,10 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= +golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -203,6 +211,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= diff --git a/quesma/main.go b/quesma/main.go index a1cb325c5..5dd003982 100644 --- a/quesma/main.go +++ b/quesma/main.go @@ -28,6 +28,8 @@ import ( "quesma/table_resolver" "quesma/telemetry" "quesma/tracing" + "quesma_v2/core" + "quesma_v2/frontend_connectors" "runtime" "syscall" "time" @@ -44,8 +46,16 @@ const banner = ` const EnableConcurrencyProfiling = false -func main() { +// buildIngestOnlyQuesma is for now a helper function to help establishing the way of v2 module api import +func buildIngestOnlyQuesma() quesma_api.QuesmaBuilder { + var quesmaBuilder quesma_api.QuesmaBuilder = quesma_api.NewQuesma() + _ = frontend_connectors.NewBasicHTTPFrontendConnector(":8080") + _ = frontend_connectors.NewHTTPRouter() + quesmaInstance, _ := quesmaBuilder.Build() + return quesmaInstance +} +func main() { if EnableConcurrencyProfiling { runtime.SetBlockProfileRate(1) runtime.SetMutexProfileFraction(1) diff --git a/quesma/main_test.go b/quesma/main_test.go new file mode 100644 index 000000000..143bbc26b --- /dev/null +++ b/quesma/main_test.go @@ -0,0 +1,11 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + +package main + +import "testing" + +// just to make sure that the buildIngestOnlyQuesma is used +func TestMain(m *testing.M) { + _ = buildIngestOnlyQuesma() +} diff --git a/v2/backend_connectors/mysql_backend_connector.go b/quesma/v2/backend_connectors/mysql_backend_connector.go similarity index 93% rename from v2/backend_connectors/mysql_backend_connector.go rename to quesma/v2/backend_connectors/mysql_backend_connector.go index f4f88d6f3..4bc5420b9 100644 --- a/v2/backend_connectors/mysql_backend_connector.go +++ b/quesma/v2/backend_connectors/mysql_backend_connector.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package backend_connectors import ( diff --git a/v2/backend_connectors/postgres_backend_connector.go b/quesma/v2/backend_connectors/postgres_backend_connector.go similarity index 91% rename from v2/backend_connectors/postgres_backend_connector.go rename to quesma/v2/backend_connectors/postgres_backend_connector.go index 885f77acd..2a3cc4095 100644 --- a/v2/backend_connectors/postgres_backend_connector.go +++ b/quesma/v2/backend_connectors/postgres_backend_connector.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package backend_connectors import ( diff --git a/v2/core/backend_connectors.go b/quesma/v2/core/backend_connectors.go similarity index 100% rename from v2/core/backend_connectors.go rename to quesma/v2/core/backend_connectors.go diff --git a/v2/core/dispatch.go b/quesma/v2/core/dispatch.go similarity index 100% rename from v2/core/dispatch.go rename to quesma/v2/core/dispatch.go diff --git a/v2/core/metadata_api.go b/quesma/v2/core/metadata_api.go similarity index 100% rename from v2/core/metadata_api.go rename to quesma/v2/core/metadata_api.go diff --git a/v2/core/quesma_apis.go b/quesma/v2/core/quesma_apis.go similarity index 100% rename from v2/core/quesma_apis.go rename to quesma/v2/core/quesma_apis.go diff --git a/v2/core/quesma_builder.go b/quesma/v2/core/quesma_builder.go similarity index 100% rename from v2/core/quesma_builder.go rename to quesma/v2/core/quesma_builder.go diff --git a/v2/core/quesma_pipeline.go b/quesma/v2/core/quesma_pipeline.go similarity index 100% rename from v2/core/quesma_pipeline.go rename to quesma/v2/core/quesma_pipeline.go diff --git a/v2/core/quesma_utils.go b/quesma/v2/core/quesma_utils.go similarity index 100% rename from v2/core/quesma_utils.go rename to quesma/v2/core/quesma_utils.go diff --git a/v2/frontend_connectors/basic_http_frontend_connector.go b/quesma/v2/frontend_connectors/basic_http_frontend_connector.go similarity index 97% rename from v2/frontend_connectors/basic_http_frontend_connector.go rename to quesma/v2/frontend_connectors/basic_http_frontend_connector.go index 3a3599852..6434e9f94 100644 --- a/v2/frontend_connectors/basic_http_frontend_connector.go +++ b/quesma/v2/frontend_connectors/basic_http_frontend_connector.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package frontend_connectors import ( diff --git a/v2/frontend_connectors/basic_tcp_connection_handler.go b/quesma/v2/frontend_connectors/basic_tcp_connection_handler.go similarity index 90% rename from v2/frontend_connectors/basic_tcp_connection_handler.go rename to quesma/v2/frontend_connectors/basic_tcp_connection_handler.go index 451000cc0..126a7511d 100644 --- a/v2/frontend_connectors/basic_tcp_connection_handler.go +++ b/quesma/v2/frontend_connectors/basic_tcp_connection_handler.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package frontend_connectors import ( diff --git a/v2/frontend_connectors/basic_tcp_connector.go b/quesma/v2/frontend_connectors/basic_tcp_connector.go similarity index 93% rename from v2/frontend_connectors/basic_tcp_connector.go rename to quesma/v2/frontend_connectors/basic_tcp_connector.go index 758e11863..e97fdd9a7 100644 --- a/v2/frontend_connectors/basic_tcp_connector.go +++ b/quesma/v2/frontend_connectors/basic_tcp_connector.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package frontend_connectors import ( diff --git a/v2/frontend_connectors/passthrough_tcp_connection_handler.go b/quesma/v2/frontend_connectors/passthrough_tcp_connection_handler.go similarity index 92% rename from v2/frontend_connectors/passthrough_tcp_connection_handler.go rename to quesma/v2/frontend_connectors/passthrough_tcp_connection_handler.go index c783e1082..2ce2e80d8 100644 --- a/v2/frontend_connectors/passthrough_tcp_connection_handler.go +++ b/quesma/v2/frontend_connectors/passthrough_tcp_connection_handler.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package frontend_connectors import ( diff --git a/v2/frontend_connectors/tcp_postgres_connection_handler.go b/quesma/v2/frontend_connectors/tcp_postgres_connection_handler.go similarity index 94% rename from v2/frontend_connectors/tcp_postgres_connection_handler.go rename to quesma/v2/frontend_connectors/tcp_postgres_connection_handler.go index 285db0101..99afac692 100644 --- a/v2/frontend_connectors/tcp_postgres_connection_handler.go +++ b/quesma/v2/frontend_connectors/tcp_postgres_connection_handler.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package frontend_connectors import ( diff --git a/v2/go.mod b/quesma/v2/go.mod similarity index 100% rename from v2/go.mod rename to quesma/v2/go.mod diff --git a/v2/go.sum b/quesma/v2/go.sum similarity index 100% rename from v2/go.sum rename to quesma/v2/go.sum diff --git a/v2/processors/ab_test_processor.go b/quesma/v2/processors/ab_test_processor.go similarity index 96% rename from v2/processors/ab_test_processor.go rename to quesma/v2/processors/ab_test_processor.go index 05884310e..cda78f495 100644 --- a/v2/processors/ab_test_processor.go +++ b/quesma/v2/processors/ab_test_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/processors/base_processor.go b/quesma/v2/processors/base_processor.go similarity index 91% rename from v2/processors/base_processor.go rename to quesma/v2/processors/base_processor.go index e46a06e3e..f89eccaac 100644 --- a/v2/processors/base_processor.go +++ b/quesma/v2/processors/base_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import quesma_api "quesma_v2/core" diff --git a/v2/processors/basic_tcp_processor.go b/quesma/v2/processors/basic_tcp_processor.go similarity index 81% rename from v2/processors/basic_tcp_processor.go rename to quesma/v2/processors/basic_tcp_processor.go index 8eabac1d3..f7eec26cb 100644 --- a/v2/processors/basic_tcp_processor.go +++ b/quesma/v2/processors/basic_tcp_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/processors/mysql_ingest_processor.go b/quesma/v2/processors/mysql_ingest_processor.go similarity index 95% rename from v2/processors/mysql_ingest_processor.go rename to quesma/v2/processors/mysql_ingest_processor.go index 79e2310fe..a81606937 100644 --- a/v2/processors/mysql_ingest_processor.go +++ b/quesma/v2/processors/mysql_ingest_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/processors/mysql_query_processor.go b/quesma/v2/processors/mysql_query_processor.go similarity index 95% rename from v2/processors/mysql_query_processor.go rename to quesma/v2/processors/mysql_query_processor.go index 78a397669..9760938e7 100644 --- a/v2/processors/mysql_query_processor.go +++ b/quesma/v2/processors/mysql_query_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/processors/postgres_ingest_processor.go b/quesma/v2/processors/postgres_ingest_processor.go similarity index 95% rename from v2/processors/postgres_ingest_processor.go rename to quesma/v2/processors/postgres_ingest_processor.go index 2e6f711a0..6fa21b95d 100644 --- a/v2/processors/postgres_ingest_processor.go +++ b/quesma/v2/processors/postgres_ingest_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/processors/postgres_query_processor.go b/quesma/v2/processors/postgres_query_processor.go similarity index 95% rename from v2/processors/postgres_query_processor.go rename to quesma/v2/processors/postgres_query_processor.go index 4e0fdb145..a2fb01e6f 100644 --- a/v2/processors/postgres_query_processor.go +++ b/quesma/v2/processors/postgres_query_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/processors/postgres_to_mysql_processor.go b/quesma/v2/processors/postgres_to_mysql_processor.go similarity index 96% rename from v2/processors/postgres_to_mysql_processor.go rename to quesma/v2/processors/postgres_to_mysql_processor.go index 3a52b7be4..85be61767 100644 --- a/v2/processors/postgres_to_mysql_processor.go +++ b/quesma/v2/processors/postgres_to_mysql_processor.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package processors import ( diff --git a/v2/test_utils.go b/quesma/v2/test_utils.go similarity index 84% rename from v2/test_utils.go rename to quesma/v2/test_utils.go index 5dd6e03b1..85f622a80 100644 --- a/v2/test_utils.go +++ b/quesma/v2/test_utils.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package v2 import ( diff --git a/v2/v2_test.go b/quesma/v2/v2_test.go similarity index 97% rename from v2/v2_test.go rename to quesma/v2/v2_test.go index 6248b0ae9..d13bb62ba 100644 --- a/v2/v2_test.go +++ b/quesma/v2/v2_test.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package v2 import ( diff --git a/v2/v2_test_objects.go b/quesma/v2/v2_test_objects.go similarity index 98% rename from v2/v2_test_objects.go rename to quesma/v2/v2_test_objects.go index 45b75bf02..acc9592a3 100644 --- a/v2/v2_test_objects.go +++ b/quesma/v2/v2_test_objects.go @@ -1,3 +1,6 @@ +// Copyright Quesma, licensed under the Elastic License 2.0. +// SPDX-License-Identifier: Elastic-2.0 + package v2 import (