From ffc6b98d5a3c897248818c8725605d19ed1062d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Barroso?= Date: Tue, 16 Apr 2024 16:46:46 +0200 Subject: [PATCH] leftovers from #131 --- README.md | 2 +- destination.go | 6 ------ destination_integration_test.go | 10 +++++----- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 191722e..cd1a82c 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ handle different payloads and keys. Because of this, each record is individually ## Table Name -If a record contains a `postgres.table` property in its metadata it will be inserted in that table, otherwise it will +If a record contains a `opencdc.collection` property in its metadata it will be inserted in that table, otherwise it will fall back to use the table configured in the connector. This way the Destination can support multiple tables in the same connector. diff --git a/destination.go b/destination.go index 8f79c4d..d0c4f80 100644 --- a/destination.go +++ b/destination.go @@ -26,12 +26,6 @@ import ( "github.com/jackc/pgx/v5" ) -const ( - // TODO same constant is defined in packages longpoll, logrepl and destination - // use same constant everywhere - MetadataOpenCDCCollection = "opencdc.collection" -) - type Destination struct { sdk.UnimplementedDestination diff --git a/destination_integration_test.go b/destination_integration_test.go index 51cda7f..1d1c1c4 100644 --- a/destination_integration_test.go +++ b/destination_integration_test.go @@ -56,7 +56,7 @@ func TestDestination_Write(t *testing.T) { record: sdk.Record{ Position: sdk.Position("foo"), Operation: sdk.OperationSnapshot, - Metadata: map[string]string{MetadataOpenCDCCollection: tableName}, + Metadata: map[string]string{sdk.MetadataCollection: tableName}, Key: sdk.StructuredData{"id": 5000}, Payload: sdk.Change{ After: sdk.StructuredData{ @@ -71,7 +71,7 @@ func TestDestination_Write(t *testing.T) { record: sdk.Record{ Position: sdk.Position("foo"), Operation: sdk.OperationCreate, - Metadata: map[string]string{MetadataOpenCDCCollection: tableName}, + Metadata: map[string]string{sdk.MetadataCollection: tableName}, Key: sdk.StructuredData{"id": 5}, Payload: sdk.Change{ After: sdk.StructuredData{ @@ -86,7 +86,7 @@ func TestDestination_Write(t *testing.T) { record: sdk.Record{ Position: sdk.Position("foo"), Operation: sdk.OperationUpdate, - Metadata: map[string]string{MetadataOpenCDCCollection: tableName}, + Metadata: map[string]string{sdk.MetadataCollection: tableName}, Key: sdk.StructuredData{"id": 6}, Payload: sdk.Change{ After: sdk.StructuredData{ @@ -101,7 +101,7 @@ func TestDestination_Write(t *testing.T) { record: sdk.Record{ Position: sdk.Position("foo"), Operation: sdk.OperationUpdate, - Metadata: map[string]string{MetadataOpenCDCCollection: tableName}, + Metadata: map[string]string{sdk.MetadataCollection: tableName}, Key: sdk.StructuredData{"id": 1}, Payload: sdk.Change{ After: sdk.StructuredData{ @@ -115,7 +115,7 @@ func TestDestination_Write(t *testing.T) { name: "delete", record: sdk.Record{ Position: sdk.Position("foo"), - Metadata: map[string]string{MetadataOpenCDCCollection: tableName}, + Metadata: map[string]string{sdk.MetadataCollection: tableName}, Operation: sdk.OperationDelete, Key: sdk.StructuredData{"id": 4}, },