From 6ad0c20624256a261f1bdcc21d08351e9ee45ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 13 Feb 2024 15:46:31 +0000 Subject: [PATCH] Add compile time requirements on interface implementations --- flow/connectors/core.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/flow/connectors/core.go b/flow/connectors/core.go index 85616a734e..55ff493ef4 100644 --- a/flow/connectors/core.go +++ b/flow/connectors/core.go @@ -207,3 +207,31 @@ func CloseConnector(ctx context.Context, conn Connector) { logger.LoggerFromCtx(ctx).Error("error closing connector", slog.Any("error", err)) } } + +// create type assertions to cause compile time error if connector interface not implemented +var ( + _ CDCPullConnector = &connpostgres.PostgresConnector{} + + _ CDCSyncConnector = &connpostgres.PostgresConnector{} + _ CDCSyncConnector = &connbigquery.BigQueryConnector{} + _ CDCSyncConnector = &connsnowflake.SnowflakeConnector{} + _ CDCSyncConnector = &conneventhub.EventHubConnector{} + _ CDCSyncConnector = &conns3.S3Connector{} + _ CDCSyncConnector = &connclickhouse.ClickhouseConnector{} + + _ CDCNormalizeConnector = &connpostgres.PostgresConnector{} + _ CDCNormalizeConnector = &connbigquery.BigQueryConnector{} + _ CDCNormalizeConnector = &connsnowflake.SnowflakeConnector{} + _ CDCNormalizeConnector = &connclickhouse.ClickhouseConnector{} + + _ QRepPullConnector = &connpostgres.PostgresConnector{} + _ QRepPullConnector = &connsqlserver.SQLServerConnector{} + + _ QRepSyncConnector = &connpostgres.PostgresConnector{} + _ QRepSyncConnector = &connbigquery.BigQueryConnector{} + _ QRepSyncConnector = &connsnowflake.SnowflakeConnector{} + _ QRepSyncConnector = &connclickhouse.ClickhouseConnector{} + + _ QRepConsolidateConnector = &connsnowflake.SnowflakeConnector{} + _ QRepConsolidateConnector = &connclickhouse.ClickhouseConnector{} +)