-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor value converters and implement ExtractValues
for Row
#75
Conversation
Codecov Report
@@ Coverage Diff @@
## master #75 +/- ##
==========================================
- Coverage 52.42% 47.13% -5.29%
==========================================
Files 30 39 +9
Lines 4273 4226 -47
==========================================
- Hits 2240 1992 -248
- Misses 1871 2092 +221
+ Partials 162 142 -20
Continue to review full report at Codecov.
|
It seems like that in the refactoring we lost this logic before each conversion (for each type it's slightly different of course):
Is there a reason for removing this? Are there more changes to note? |
To my best understanding, such a type conversion is not needed if we have a polymorphism method This code snippet may help you understand the idea: https://go.dev/play/p/j4rZWDJrdCu |
Got it. First of all, can you merge from main? there had been some changes and I want to resolve the conflicts early. For now, can you expand the test you wrote to cover all types, just to make sure we didn't miss anything. I also think we should check ExtractValue in etoe tests, I might add it myself to this PR. |
Pull Request Description
This PR proposes a fix for #72 , which includes the following changes:
Row.ToStruct
. Now, each value type has its own Convert method, which transforms its value into areflect.Value
. All Convert methods are taken as is from the logic used byRow.ToStruct
. Moreover, each value type is placed in its own go source file because thevalue.go
file has too many lines.ExtractValues
is added to struct Row. This method implements the intended functionality ofColumns
, which allows users to unpack the row's values into interfaces, enabling convenient and simplified access to these values.Row.Columns
.ExtractValues
can be used like this:Future Release Comment
Features:
Row.ExtractValues
is added to easily unpack a row's values into a set of interfaces.