diff --git a/go.mod b/go.mod index 1eb8edde..9c0d277a 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.26.29 + github.com/artie-labs/transfer v1.26.31 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 024e130f..2d9e32e1 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,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.26.29 h1:oqyeGX1nAIbD1PEZ7/FUSUHLGycKnP456Mbpw4Wgjxs= -github.com/artie-labs/transfer v1.26.29/go.mod h1:+a/UhlQVRIpdz3muS1yhSvyX42RQL0LHOdovGZfEsDE= +github.com/artie-labs/transfer v1.26.31 h1:mnz50FnH8MLnEu83FdK5z/E5zZD42hR2Hz9i1Uqxz/A= +github.com/artie-labs/transfer v1.26.31/go.mod h1:+a/UhlQVRIpdz3muS1yhSvyX42RQL0LHOdovGZfEsDE= 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/lib/debezium/converters/decimal_test.go b/lib/debezium/converters/decimal_test.go index b16d7a79..adc09f8c 100644 --- a/lib/debezium/converters/decimal_test.go +++ b/lib/debezium/converters/decimal_test.go @@ -216,9 +216,10 @@ func TestDecimalConverter_Convert(t *testing.T) { assert.NoError(t, err) bytes, ok := converted.([]byte) assert.True(t, ok) - actualValue, err := converter.ToField("").DecodeDecimal(bytes) + + actualValue, err := converter.ToField("").ParseValue(bytes) assert.NoError(t, err) - assert.Equal(t, "1.23", fmt.Sprint(actualValue)) + assert.Equal(t, "1.23", actualValue.(*decimal.Decimal).String()) } } diff --git a/lib/debezium/converters/money_test.go b/lib/debezium/converters/money_test.go index 6e6d6e6c..6c412525 100644 --- a/lib/debezium/converters/money_test.go +++ b/lib/debezium/converters/money_test.go @@ -5,6 +5,7 @@ import ( "github.com/artie-labs/reader/lib/ptr" transferDbz "github.com/artie-labs/transfer/lib/debezium" + "github.com/artie-labs/transfer/lib/typing/decimal" "github.com/stretchr/testify/assert" ) @@ -41,9 +42,12 @@ func TestMoneyConverter_Convert(t *testing.T) { decodeValue := func(value any) string { bytes, ok := value.([]byte) assert.True(t, ok) - val, err := decimalField.DecodeDecimal(bytes) + + valueConverter, err := decimalField.ToValueConverter() + assert.NoError(t, err) + val, err := valueConverter.Convert(bytes) assert.NoError(t, err) - return val.String() + return val.(*decimal.Decimal).String() } { // Converter where mutateString is true diff --git a/lib/debezium/converters/time_test.go b/lib/debezium/converters/time_test.go index 6380d1a8..237ddc7d 100644 --- a/lib/debezium/converters/time_test.go +++ b/lib/debezium/converters/time_test.go @@ -1,7 +1,6 @@ package converters import ( - "fmt" "math" "testing" "time" @@ -12,20 +11,6 @@ import ( ) func parseUsingTransfer(converter ValueConverter, value int64) (*ext.ExtendedTime, error) { - if transferConverter := converter.ToField("foo").ToValueConverter(); transferConverter != nil { - val, err := transferConverter.Convert(value) - if err != nil { - return nil, err - } - - extTime, isOk := val.(*ext.ExtendedTime) - if !isOk { - return nil, fmt.Errorf("expected *ext.ExtendedTime got %T", val) - } - - return extTime, nil - } - parsedValue, err := converter.ToField("foo").ParseValue(value) if err != nil { return nil, err diff --git a/sources/postgres/adapter/adapter_test.go b/sources/postgres/adapter/adapter_test.go index 80e5071c..6e924e90 100644 --- a/sources/postgres/adapter/adapter_test.go +++ b/sources/postgres/adapter/adapter_test.go @@ -9,6 +9,7 @@ import ( "github.com/artie-labs/reader/lib/postgres" "github.com/artie-labs/reader/lib/postgres/schema" "github.com/artie-labs/transfer/lib/debezium" + "github.com/artie-labs/transfer/lib/typing/decimal" ) func TestPostgresAdapter_TableName(t *testing.T) { @@ -262,10 +263,10 @@ func TestValueConverterForType_Convert(t *testing.T) { if tc.numericValue { bytes, ok := actualValue.([]byte) assert.True(t, ok) - field := converter.ToField(tc.col.Name) - val, err := field.DecodeDecimal(bytes) + + val, err := converter.ToField(tc.col.Name).ParseValue(bytes) assert.NoError(t, err, tc.name) - assert.Equal(t, tc.expectedValue, val.String(), tc.name) + assert.Equal(t, tc.expectedValue, val.(*decimal.Decimal).String(), tc.name) } else { assert.Equal(t, tc.expectedValue, actualValue, tc.name) }