-
Notifications
You must be signed in to change notification settings - Fork 16
Change underlying data structure of resultSet
#38
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
Change underlying data structure of resultSet
#38
Conversation
From `map[string]interface{}` to `OrderedDict`.
Thanks, and I mean it!! While this should not be a problem to merge (no regressions, an ordered map is an unordered map, so to speak), I still feel this is not the right way, because in json a map is unordered. I'd rather implement the solution proposed in the issue discussion, in due time. Anyway, I'll merge this, allow me some time to review. Thanks again! |
Suggestion: you might want to look at this library (https://github.com/stretchr/testify) for assertion, and test suite setting up plus tearing down. I think depending on the way Go collects tests for setting up and tearing down can increase the complexity of the code and debugging a bit 😅. |
I think it's solid, and thanks. What is the reason for |
Tests pass. Thanks, and merging now. |
Please notice that after this, I cannot implement the solution for proofrock/sqliterg#5 anymore, because EDIT: I can work around it, sorry |
|
I see and 👍. What I plan to do is to use a generic |
This works fine, but in practice it introduces an inconsistency. The json that it produces is ordered, but when it parses the same json it attempts to parse it unordered. This is apparent if you substitute But then all tests fail, because when it parses the json it parses a What if we maintain the unordered map (as I said, json is unordered) and add a list of column headers as an additional response field? You could read the order from this list and get them from the map. And I would do also the resultset-as-list. This should cover your use case, and it would be more... coherent. |
Alternate: since it's not strictly necessary in the tests to have an orderedmap, let it deserialize to To tell the truth, I don't like it too much. But I'll do this for now. |
From
map[string]interface{}
toOrderedDict
.Should serve as a prototype to proofrock/sqliterg#5.