When we execute queries to our PostgreSQL Database and receive responses, we then pass these responses to our clientside to display/work with.
Example:
const response = [
{
first_name: 'Bob',
last_name: 'English',
title: 'The Dude',
},
{
first_name: 'Harry',
last_name: 'Smith',
title: 'Unknown',
},
];
Our app then has to map over this and rename the keys in a rather inefficient and verbose manner. Is there a better way? Perhaps using pg-promise
?
Worth noting we also have to convert back when we send the data as an UPDATE
to the DB.
It's worth noting we are not looking to use a ORM like Objection or a query builder like Knex.