ArsenyYankovsky / typeorm-aurora-data-api-driver

A bridge between TypeORM and Aurora Data API
MIT License
175 stars 38 forks source link

transformer from is not called. #153

Open nxzz opened 2 years ago

nxzz commented 2 years ago

Package versions and database engine type (please complete the following information):

Describe the bug @Column transformer from is not called.

To Reproduce https://github.com/nxzz/typeorm-aurora-data-api-driver-transform-issue/tree/4f2f67e65cc7e9fd3e7866952303239151b7e154 When I run the code in this repository, transformer from is not displayed as shown below.

$ secretArn="xxxxxx" resourceArn="xxxxxxx" npx ts-node main.ts
transformer to
TestData { id: 1, data: 'testdata' }
[ TestData { id: 1, data: 'testdata' } ]
TestData { id: 1, data: 'testdata' }

If the DataSource is mysql, you will see transformer from as shown below.

$ npx ts-node mysql.ts
transformer to
TestData { id: 1, data: 'testdata' }
transformer from
[ TestData { id: 1, data: 'TESTDATA' } ]
transformer from
TestData { id: 1, data: 'TESTDATA' }

Thankyou.

CorentinDoue commented 2 years ago

I reproduced this too. If it can help, we constated that the from transformer is called when the value is null. It's not very useful.

nxzz commented 2 years ago

I can't create a PR because I don't have time to write test code, but I got it to work with this patch. https://github.com/ArsenyYankovsky/typeorm-aurora-data-api-driver/compare/master...nxzz:typeorm-aurora-data-api-driver:master#diff-16226b3f7ac28247a0d19adda562aa4fa0fe3aa25dcd1edef430e84d286226eb