feat(codegen): Allow consumers to override field types#139
feat(codegen): Allow consumers to override field types#139erezrokah wants to merge 13 commits intocloudquery:mainfrom
Conversation
yevgenypats
left a comment
There was a problem hiding this comment.
This needs some more testing and I think we need to add the string comparison back, I recall there wasn't another way, maybe @hermanschaaf can weigh in as I dont remember on top of my head.
There was a problem hiding this comment.
I think this makes sense, and will enable us to handle a wide range of cases that we will eventually need to handle. It also seems better than trying to handle every possible type in the SDK.
I wonder if the reflect.Type passed in will be enough to handle all the cases though? What if the value type decision depended on the name of the field in a struct? Like maybe you'd want to convert things with Date in the name to timestamp, even though their Go type is string. For that reason, we may want to provide the full field reflect.StructField, rather than just the reflect.Type of the field.
Also, could you add a test case or two for this functionality? Nvm, I see you did a few minutes ago
Good point I was wondering that too. Lets go with passing the |
yevgenypats
left a comment
There was a problem hiding this comment.
Looks good. Have one suggestion on the function type
#### Summary Depends on cloudquery/plugin-sdk#139. Fixes #1826 ---
Co-authored-by: Herman Schaaf <hermanschaaf@gmail.com>
486a85f to
c8e4be3
Compare
|
I think I messed up the rebase, let me check this PR again |
|
@candiduslynx can you please check, I think I fixed the bad rebase I did and @yevgenypats please review |
|
Continued in #157 |
This is take two of #139 Trying to get right the `WithTypeTransformer` so we wont have to change it in the near future as it's heavilly used external API. I've also added error handling to all functions as we were basically ignoring all of them and printing to the screen is not the right approach catching those locally and in CI. --- Use the following steps to ensure your PR is ready to be reviewed - [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md) 🧑🎓 - [ ] Run `go fmt` to format your code 🖊 - [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation)) - [ ] Update or add tests 🧪 - [ ] Ensure the status checks below are successful ✅ Co-authored-by: erezrokah <erezrokah@users.noreply.github.com> Co-authored-by: Herman Schaaf <hermanschaaf@gmail.com>
Summary
I guess this is a difference way to do #135 in order to fix write errors in the Azure plugin. See corresponding PR cloudquery/cloudquery#1885
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)