Skip to content

Commit

Permalink
Add compile time requirements on interface implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 13, 2024
1 parent 467c31f commit 6ad0c20
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions flow/connectors/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
)

0 comments on commit 6ad0c20

Please sign in to comment.