Skip to content

Commit

Permalink
Make the payload object public (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored May 2, 2023
1 parent 14cf06a commit f55aab3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/cdc/util/relational_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
9 changes: 4 additions & 5 deletions lib/cdc/util/relational_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ func TestSource_GetOptionalSchema(t *testing.T) {
assert.False(t, isOk)
}


func TestSource_GetExecutionTime(t *testing.T) {
source := Source{
Connector: "postgresql",
TsMs: 1665458364942, // Tue Oct 11 2022 03:19:24
}

schemaEventPayload := &SchemaEventPayload{
Payload: payload{Source: source},
Payload: Payload{Source: source},
}

assert.Equal(t, time.Date(2022, time.October,
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit f55aab3

Please sign in to comment.