-
Notifications
You must be signed in to change notification settings - Fork 494
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
postgres: add column name to the result of query function. #3201
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4aa1955
Update postgres.go
Jack397419 dcf9163
Merge branch 'master' into master
Jack397419 78c9aea
Update postgres.go
Jack397419 5d09c2e
Merge branch 'master' of https://github.com/Jack397419/components-con…
Jack397419 de9018c
Merge branch 'master' into master
berndverst 5fadd43
Merge branch 'master' into master
berndverst f33c322
Merge branch 'main' into master
berndverst 19dfe67
Merge branch 'main' into master
yaron2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, this is a breaking change. Currently, users expect to receive a slice, but with this, they will receive a map. This will break all existing users.
Perhaps this should be a configurable option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Infact, the query function return a json, not a map or a slice: "result, err = json.Marshal(rs)", and the json should include column name,like the query function in mysql.go: "result, err := m.jsonify(rows)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my point is: that is a breaking change. If users expect the JSON to contain an array, and you're now returning a dictionary, that will break applications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your opinion, and we expect the JSON contain a dictionary,how to make a configurable option? Can you help me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to do this via request metadata which a user would need to specify to enable your new functionality, or introduce a new operation code. You can look at the code of other bindings to see how this can be done.