Skip to content
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

Support custom conversion overrides for all types #40

Open
cretz opened this issue Nov 29, 2016 · 1 comment
Open

Support custom conversion overrides for all types #40

cretz opened this issue Nov 29, 2016 · 1 comment
Assignees

Comments

@cretz
Copy link
Contributor

cretz commented Nov 29, 2016

In the DataConverter, you have get which supports custom converters, but all the other methods like getArray do not. This should be rearchitected. You should make static Converter instances for all of the base types and initialize the typeToConverter map with all of them. Then even something like toInteger would be:

public Integer toInteger(Oid oid, byte[] value) {
    return toObject(Integer.class, oid, value);
}

This is much more flexible and would really help. For instance, I have to convert an enum array, which is a string array but the oid is UNSPECIFIED but I can't override your array logic from the outside without extending the DataConverter class.

@alaisi alaisi self-assigned this Nov 29, 2016
@cretz
Copy link
Contributor Author

cretz commented Jul 2, 2018

Just as an update, I went ahead and wrote my own lib to solve all sorts of issues: https://github.com/cretz/pgnio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants