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

Q: autoJSONify #32

Open
mche opened this issue Oct 17, 2017 · 6 comments
Open

Q: autoJSONify #32

mche opened this issue Oct 17, 2017 · 6 comments
Assignees

Comments

@mche
Copy link

mche commented Oct 17, 2017

Hi!

Let me stupid question. Do you have planned to autoJSONify from Perl data to PG json/jsonb data types and backwards?

Regards.

@turnstep
Copy link
Contributor

turnstep commented Feb 4, 2018

Yes, it's been on our long-term todo for a while. Not sure when people will have tuits for this: it's a non-trivial task.

@turnstep turnstep self-assigned this Aug 15, 2019
@machack666
Copy link
Collaborator

@turnstep are you thinking of rolling-your-own serialization/deserialization, or just hooking into JSON::XS or similar?

@turnstep
Copy link
Contributor

We need to do our own parsing regardless, in the same way the arrays are done now. Whether or how to involve JSON::XS is somewhat secondary at the moment.

@waaeer
Copy link

waaeer commented Sep 25, 2019

JSON is probably the most important type for automatic conversion in DBD::Pg, but not the only one.
In some cases users may want to convert NUMERICSs to Math::BigInt or Math::BigFloat; dates/times and composite types also may be converted to something etc.

Do the thing I am thinking about is to allow custom conversion for the data types. A user may be given a possibility to specify converters for the data types (like TRANSFORMS in stored procedures). Something like
$dbi->set_transform('jsonb', &JSON::XS::encode_json,&JSON::XS::decode_json)
This would be a flexible universal solution.

@turnstep
Copy link
Contributor

That sounds nice in theory, but I'm not sure how that would work in practice. The conversions happen in the Perl XS code, and involve low-level transformations of textual representations of certain types to Perl objects.

@ap
Copy link

ap commented Mar 4, 2022

Not sure when people will have tuits for this: it's a non-trivial task.

What areas does the complexity reside in?

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

No branches or pull requests

5 participants