4 ms·
Thanks porsager. Any plans for Knex support?
by ruffrey 5y ago
Thanks porsager. Any plans for Knex support?
- hn_throwaway_99 5y ago> Any plans for Knex support? That question doesn't really make sense. I'm not familiar with this library, but the developer interface is very similar to slonik. The whole point of this is that SQL tagged template literals replace the need for a query builder like Knex. Here is a good blog post from the author of slonik explaining: https://gajus.medium.com/stop-using-knex-js-and-earn-30-bf410349856c https://gajus.medium.com/stop-using-knex-js-and-earn-30-bf41...
- deleted 5y ago[deleted]
- spiffytech 5y agoI'm broadly a fan of just writing SQL, but Knex does have one important advantage: it automatically declares the return types from a query based on my DB structure. If I write SQL by hand, I have to annotate the query with the return types, and those annotations can get out of sync with the query.
- hn_throwaway_99 5y agoSlonik has a typegen package that works great, https://www.npmjs.com/package/@slonik/typegen https://www.npmjs.com/package/@slonik/typegen
- whenlambo 5y agoPostgres.js does the same, transparently. No advantages of Knex here.
- porsager 5y agoYeah, I think it could make sense for performance reasons to make a version for Knex, but since I try to stay away from ORMs as much as possible I'm probably not the right one to make it ;) I also wouldn't put it in the core library anyway, so it should be straight forward for someone else to make a knex-postgres package that does this?
- danielskogly 5y agoKnex is a query builder, not an ORM :) Would love to replace pg with your library for the performance gains!