Code Monkey home page Code Monkey logo

Comments (6)

turnstep avatar turnstep commented on August 21, 2024 1

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.

from dbdpg.

waaeer avatar waaeer commented on August 21, 2024 1

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.

from dbdpg.

machack666 avatar machack666 commented on August 21, 2024

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

from dbdpg.

turnstep avatar turnstep commented on August 21, 2024

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.

from dbdpg.

turnstep avatar turnstep commented on August 21, 2024

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.

from dbdpg.

ap avatar ap commented on August 21, 2024

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

What areas does the complexity reside in?

from dbdpg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.