diff --git a/go.mod b/go.mod index fb2fb8b0..90e86e04 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/DataDog/datadog-go/v5 v5.5.0 - github.com/artie-labs/transfer v1.27.19 + github.com/artie-labs/transfer v1.27.22 github.com/aws/aws-sdk-go-v2 v1.30.3 github.com/aws/aws-sdk-go-v2/config v1.27.27 github.com/aws/aws-sdk-go-v2/credentials v1.17.27 diff --git a/go.sum b/go.sum index 7345d387..dc8be6b9 100644 --- a/go.sum +++ b/go.sum @@ -98,8 +98,8 @@ github.com/apache/thrift v0.0.0-20181112125854-24918abba929/go.mod h1:cp2SuWMxlE github.com/apache/thrift v0.14.2/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.17.0 h1:cMd2aj52n+8VoAtvSvLn4kDC3aZ6IAkBuqWQ2IDu7wo= github.com/apache/thrift v0.17.0/go.mod h1:OLxhMRJxomX+1I/KUw03qoV3mMz16BwaKI+d4fPBx7Q= -github.com/artie-labs/transfer v1.27.19 h1:OoO2pwkU+H/XYeh4sHLI7vjkFvITuoHRTLkjFN8Bkv8= -github.com/artie-labs/transfer v1.27.19/go.mod h1:Lbrj8nz/cCq5BycDR++l3K+kc2GUbEnGRyrVDyA8MfM= +github.com/artie-labs/transfer v1.27.22 h1:Frd6mp/jKOF6NIcspNtS6unuoL5ISKKCmhBNMIlEHnU= +github.com/artie-labs/transfer v1.27.22/go.mod h1:Lbrj8nz/cCq5BycDR++l3K+kc2GUbEnGRyrVDyA8MfM= github.com/aws/aws-sdk-go v1.30.19/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v1.16.12/go.mod h1:C+Ym0ag2LIghJbXhfXZ0YEEp49rBWowxKzJLUoob0ts= github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY= diff --git a/integration_tests/mongo/main.go b/integration_tests/mongo/main.go index 5b7320b4..1e365024 100644 --- a/integration_tests/mongo/main.go +++ b/integration_tests/mongo/main.go @@ -18,7 +18,6 @@ import ( mongoLib "github.com/artie-labs/reader/sources/mongo" xferMongo "github.com/artie-labs/transfer/lib/cdc/mongo" "github.com/artie-labs/transfer/lib/kafkalib" - "github.com/artie-labs/transfer/lib/typing/ext" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -175,11 +174,11 @@ func testTypes(ctx context.Context, db *mongo.Database, mongoCfg config.MongoDB) expectedPayload := map[string]any{ "objectId": "66a95fae3776c2f21f0ff568", "array": []any{"item1", int32(2), true, 3.14}, - "datetime": ext.NewExtendedTime(ts, ext.TimestampTZKindType, "2006-01-02T15:04:05.999-07:00"), + "datetime": ts, "int64": int64(64), "__artie_delete": false, "__artie_only_set_delete": false, - "timestamp": ext.NewExtendedTime(ts, ext.TimestampTZKindType, "2006-01-02T15:04:05.999-07:00"), + "timestamp": ts, "embeddedDocument": `{"field1":"value1","field2":"value2"}`, "embeddedMap": `{"foo":"bar","hello":"world","pi":3.14159}`, "binary": `{"$binary":{"base64":"YmluYXJ5IGRhdGE=","subType":"00"}}`, diff --git a/lib/debezium/converters/time_test.go b/lib/debezium/converters/time_test.go index 076aeec6..1c5e59d3 100644 --- a/lib/debezium/converters/time_test.go +++ b/lib/debezium/converters/time_test.go @@ -20,6 +20,15 @@ func parseUsingTransfer(converter ValueConverter, value int64) (*ext.ExtendedTim return typing.AssertType[*ext.ExtendedTime](parsedValue) } +func parseUsingTransferNew(converter ValueConverter, value int64) (time.Time, error) { + parsedValue, err := converter.ToField("foo").ParseValue(value) + if err != nil { + return time.Time{}, err + } + + return typing.AssertType[time.Time](parsedValue) +} + func TestTimeConverter_Convert(t *testing.T) { converter := TimeConverter{} { @@ -191,10 +200,9 @@ func TestDateConverter_Convert(t *testing.T) { // Transfer parsing value, err := converter.Convert("2023-05-03") assert.NoError(t, err) - transferValue, err := parseUsingTransfer(converter, int64(value.(int32))) + transferValue, err := parseUsingTransferNew(converter, int64(value.(int32))) assert.NoError(t, err) - assert.Equal(t, time.Date(2023, time.May, 3, 0, 0, 0, 0, time.UTC), transferValue.GetTime()) - assert.Equal(t, ext.DateKindType, transferValue.GetNestedKind().Type) + assert.Equal(t, time.Date(2023, time.May, 3, 0, 0, 0, 0, time.UTC), transferValue) } } @@ -243,10 +251,9 @@ func TestMicroTimestampConverter_Convert(t *testing.T) { timeValue := time.Date(2001, 2, 3, 4, 5, 0, 0, time.UTC) value, err := converter.Convert(timeValue) assert.NoError(t, err) - transferValue, err := parseUsingTransfer(converter, value.(int64)) + transferValue, err := parseUsingTransferNew(converter, value.(int64)) assert.NoError(t, err) - assert.Equal(t, timeValue, transferValue.GetTime()) - assert.Equal(t, ext.TimestampNTZKindType, transferValue.GetNestedKind().Type) + assert.Equal(t, timeValue, transferValue) } } diff --git a/lib/mongo/message_test.go b/lib/mongo/message_test.go index 75d80928..621ed9f7 100644 --- a/lib/mongo/message_test.go +++ b/lib/mongo/message_test.go @@ -3,7 +3,6 @@ package mongo import ( "encoding/json" "fmt" - "github.com/artie-labs/transfer/lib/typing/ext" "testing" "time" @@ -106,7 +105,7 @@ func TestParseMessage(t *testing.T) { "decimal": "1234.5", "subDocument": `{"nestedString":"Nested value"}`, "array": []any{"apple", "banana", "cherry"}, - "datetime": ext.NewExtendedTime(time.Date(2024, time.February, 13, 20, 37, 48, 0, time.UTC), ext.TimestampTZKindType, "2006-01-02T15:04:05.999-07:00"), + "datetime": time.Date(2024, time.February, 13, 20, 37, 48, 0, time.UTC), "trueValue": true, "falseValue": false, "nullValue": nil,