postgres-async-driver icon indicating copy to clipboard operation
postgres-async-driver copied to clipboard

Support custom conversion overrides for all types

Open cretz opened this issue 8 years ago • 1 comments

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.

cretz avatar Nov 29 '16 18:11 cretz

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

cretz avatar Jul 02 '18 15:07 cretz