Coder Social home page Coder Social logo

Comments (6)

charmander avatar charmander commented on July 24, 2024

It’s unlikely to be a performance issue, but I’m not sure why types.arrayParser.create exists at all. (Backwards compatibility?) postgresArray.parse(val, parseInt) with a dependency on postgres-array is fine.

from node-pg-types.

jeremychone avatar jeremychone commented on July 24, 2024

Not sure, it was exported in the "@types/pg": "^7.4.10" so I assumed it was the way to do it (and I had to do some digging). Somehow, creating a function per value parsing felt off, but I agree hard to know if it is a performance issue until it is.

But great, I will use the postgresArray.parse, feels more common.

On a related note, would be great if the pg module could export postgresArray and that the parse be in the @types/pg. Right now there is no @types/postgres-array, not deal breaker, just a little cumbersome to use.

Thanks for the fast response, and for this high quality lib. node-postgres's quality has been critical in our decision to move our "big app" dev to node from Java.

from node-pg-types.

bendrucker avatar bendrucker commented on July 24, 2024

I've refactored this library a bit over time. Pulled out some of the larger concepts (e.g. arrays, dates) into their own module. But generally kept the API the same.

You should feel free to depend on postgres-array, that's what I was hoping for when publishing it separately (easier to build custom behavior).

As for performance, I'm hesitant to start picking at anything without benchmarks. You're probably right in this case but it's hard to say what the magnitude of impact would be. I'm open to working on that across the node/pg toolchain at some point.

from node-pg-types.

jeremychone avatar jeremychone commented on July 24, 2024

Cool thanks. If you want I and contribute the @types/postgres-array to npm or even better, do a pull request on postgres-array with the type definition. Does not change anything for non typescript users, but removes quite a bit of pain for TS user.

from node-pg-types.

bendrucker avatar bendrucker commented on July 24, 2024

do a pull request on postgres-array with the type definition

Please do!

from node-pg-types.

jeremychone avatar jeremychone commented on July 24, 2024

@bendrucker Just did the pull request, sorry for the delay.

from node-pg-types.

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.