From f55aab37e6a38c7ab450faa328797494560221d6 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Mon, 1 May 2023 19:45:58 -0700 Subject: [PATCH] Make the payload object public (#85) --- lib/cdc/util/relational_event.go | 4 ++-- lib/cdc/util/relational_event_test.go | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/cdc/util/relational_event.go b/lib/cdc/util/relational_event.go index 2691262b9..66c8fc8ce 100644 --- a/lib/cdc/util/relational_event.go +++ b/lib/cdc/util/relational_event.go @@ -16,10 +16,10 @@ import ( // SchemaEventPayload is our struct for an event with schema enabled. For reference, this is an example payload https://gist.github.com/Tang8330/3b9989ed8c659771958fe481f248397a type SchemaEventPayload struct { Schema debezium.Schema `json:"schema"` - Payload payload `json:"payload"` + Payload Payload `json:"payload"` } -type payload struct { +type Payload struct { Before map[string]interface{} `json:"before"` After map[string]interface{} `json:"after"` Source Source `json:"source"` diff --git a/lib/cdc/util/relational_event_test.go b/lib/cdc/util/relational_event_test.go index c0b63a4ef..9698b2919 100644 --- a/lib/cdc/util/relational_event_test.go +++ b/lib/cdc/util/relational_event_test.go @@ -66,7 +66,6 @@ func TestSource_GetOptionalSchema(t *testing.T) { assert.False(t, isOk) } - func TestSource_GetExecutionTime(t *testing.T) { source := Source{ Connector: "postgresql", @@ -74,7 +73,7 @@ func TestSource_GetExecutionTime(t *testing.T) { } schemaEventPayload := &SchemaEventPayload{ - Payload: payload{Source: source}, + Payload: Payload{Source: source}, } assert.Equal(t, time.Date(2022, time.October, @@ -91,7 +90,7 @@ func TestGetDataTestInsert(t *testing.T) { var tc kafkalib.TopicConfig schemaEventPayload := SchemaEventPayload{ - Payload: payload{ + Payload: Payload{ Before: nil, After: after, Operation: "c", @@ -116,7 +115,7 @@ func TestGetDataTestDelete(t *testing.T) { now := time.Now().UTC() schemaEventPayload := SchemaEventPayload{ - Payload: payload{ + Payload: Payload{ Before: nil, After: nil, Operation: "c", @@ -161,7 +160,7 @@ func TestGetDataTestUpdate(t *testing.T) { var tc kafkalib.TopicConfig schemaEventPayload := SchemaEventPayload{ - Payload: payload{ + Payload: Payload{ Before: before, After: after, Operation: "c",