2 ms·
I'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 struct
by spiffytech 5y ago
I'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.