Skip to content

Commit

Permalink
Upgrade Artie Transfer dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 31, 2024
1 parent b00b87c commit d0fc812
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
19 changes: 13 additions & 6 deletions lib/debezium/converters/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
{
Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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)
}
}

Expand Down
3 changes: 1 addition & 2 deletions lib/mongo/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mongo
import (
"encoding/json"
"fmt"
"github.com/artie-labs/transfer/lib/typing/ext"
"testing"
"time"

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d0fc812

Please sign in to comment.