Skip to content

Add support to decode enums and other types as String #454

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

Closed
wants to merge 3 commits into from

Conversation

jbellassai
Copy link
Contributor

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You use the code formatters provided here and have them applied to your changes. Don't submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

Issue description

Fixes (or at least makes progress towards) #429

If there is no immediately suitable codec can be found and the request is to decode as a String, then fallback to using the VARCHAR codec.

[pgjdbc#429]
Automatically register an EnumStringCodec and an EnumStringArrayCodec for enums.

[pgjdbc#429]
@jbellassai
Copy link
Contributor Author

It would be great if this could be back ported to 0.8.x as well

@mp911de mp911de self-assigned this Oct 25, 2021
@mp911de mp911de added the type: enhancement A general enhancement label Oct 25, 2021
@mp911de mp911de added this to the 0.8.11.RELEASE milestone Oct 25, 2021
@mp911de mp911de changed the title [#429] Support enums and other types as Strings Add support to decode enums and other types as String Oct 26, 2021
@mp911de
Copy link
Collaborator

mp911de commented Oct 26, 2021

Thanks for your pull request. I'm going to generalize decoder support to fall back onto a codec that simply decodes the payload when no other codec was found. That simplifies the arrangement because it doesn't require any application configuration regarding enum codecs.

@mp911de mp911de linked an issue Oct 26, 2021 that may be closed by this pull request
mp911de pushed a commit that referenced this pull request Oct 26, 2021
mp911de pushed a commit that referenced this pull request Oct 26, 2021
If there is no immediately suitable codec can be found and the request is to decode as a String, then fallback to using the VARCHAR codec.

[#454][#429]
mp911de pushed a commit that referenced this pull request Oct 26, 2021
Automatically register an EnumStringCodec and an EnumStringArrayCodec for enums.

[#454][resolves #429]
@mp911de mp911de closed this in c7911a2 Oct 26, 2021
mp911de pushed a commit that referenced this pull request Oct 26, 2021
mp911de pushed a commit that referenced this pull request Oct 26, 2021
If there is no immediately suitable codec can be found and the request is to decode as a String, then fallback to using the VARCHAR codec.

[#454][#429]
mp911de pushed a commit that referenced this pull request Oct 26, 2021
Automatically register an EnumStringCodec and an EnumStringArrayCodec for enums.

[#454][resolves #429]
mp911de added a commit that referenced this pull request Oct 26, 2021
Refactor enum to string codecs into StringDecoder and StringArrayDecoder as fallback codecs if no other codec could be found. Allow reuse of ArrayCodec.

[#454][resolves #454]

Signed-off-by: Mark Paluch <[email protected]>
@mp911de
Copy link
Collaborator

mp911de commented Oct 26, 2021

Thank you for your contribution. That's merged, polished, and backported now.

mp911de added a commit that referenced this pull request Oct 26, 2021
Refactor enum to string codecs into StringDecoder and StringArrayDecoder as fallback codecs if no other codec could be found. Allow reuse of ArrayCodec.

[#429][resolves #454]

Signed-off-by: Mark Paluch <[email protected]>
mp911de added a commit that referenced this pull request Oct 26, 2021
Refactor enum to string codecs into StringDecoder and StringArrayDecoder as fallback codecs if no other codec could be found. Allow reuse of ArrayCodec.

[#429][resolves #454]

Signed-off-by: Mark Paluch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for reading arbitrary enum values as String
2 participants