Fork me on GitHub

Is there an option to pass somewhere in next.jdbc to automatically convert JSONB columns from postgres, but that doesn't involve extending the result-set/ReadableColumn protocol?


We're currently extending that protocol, but I'm wondering if there's a more functional, less protocol based method of achieving the same result of JSONB column values being converted to EDN automatically on SELECT calls


Why protocols are a problem?


just as additional data point, I have also found the protocol way a bit it's global - that might be a disadvantage, depending of course on what you are doing...not a big deal anyways


Not a problem, per se, but the side-affecting nature of loading a namespace with protocol extensions has me wondering if there's a way without protocols.


Specifically, forcing everyone to have json column values parsed in the same way has me wondering about alternatives.


The functional alternative is to... have a function which wraps your query functions and parses JSONB columns, right? I'd assume that's less performant though (I might be wrong, I prefer to extend the protocol and not worry about wrapping my functions to properly (de)serialize JSON columns).


I'm not sure about the performance impact, though I also assume it'd be slower.


I don't have any data to back that up though.


You could write a builder adapter that applied the conversion and then use default options if you wanted to make that builder your default (for a given datasource). There are caveats, and it’s probably a lot more work, but it is doable.


That's good to know, thank you. I'll start with protocols and keep that in mind if/when we need to switch away from them.