Option to convert query rows snake_case fields to camelCase
See original GitHub issueIs it possible for node-postgres
to have a configuration option to convert snake_case database fields into camelCase automagically for the result.rows
when a successful query is returned?
I understand I could write a function to loop and pass it through myself, but I feel like that would be a double-up / extra process work. As the query already builds the rows, why not have the option of camelCase conversion too rather than query building the rows, then having to re-build them myself.
Issue Analytics
- State:
- Created 10 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
node.js - Most efficient way of transforming query result ...
Both approaches are fine. You can do it either in SQL: const {rows} = await db.query( `SELECT first_name AS "firstName", middle_name AS ...
Read more >Snake case to camel case conversion | Objection.js
When the conversion is done on knex level everything is converted to camel case including properties and identifiers in relationMappings and queries.
Read more >Converting snake_case and camelCase between SQL and ...
One approach that addresses this, is manually renaming in your SQL queries using AS clause. For example, when querying the database you could ......
Read more >Deserialize Snake Case to Camel Case With Jackson
In this article, we've seen different ways to deserialize snake case JSON to camel case fields using Jackson.
Read more >postgresql - Should I not use camelCase in my column names?
lodash has snakeCase and camelCase functions that should come in handy. ... in camel case (and constantly be wrapping your SQL query column ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If there is anybody interessted: https://www.npmjs.org/package/pg-camelcase
I don’t think such a thing should be in in
node-postgres
. I wouldn’t want my client to change data in such a way.This being said, I think you have (amongs others) following possibilities:
SELECT 1 AS nowThisIsSomeAwesomeCamelCase;
HTH