Description
Feature request
Is your feature request related to a problem? Please describe.
postgres column naming conventions suggest using snake_case. Javascript variable naming conventions typically use camelCase. This leads to a few issues when trying to interact with the postgres database using the postgrest-js api.
I either have to use snake_case for my object keys in my javascript code, but this is then inconsistent with the rest of my code.
I could also use camelCase for my postgres column names, but then this creates a lot of friction with queries as casing is ignored without "".
Or I could automatically convert the keys from camelCase to snake_case before sending any data, and from snake_case to camelCase when receiving data.
Describe the solution you'd like
A config setting, or option that will automatically convert object keys from camelCase to snake_case when sending data.
Having a table with columns: user_name
and date_added
. The following would work:
const data = [{userName: "abc123", dateAdded: "2021-01-01"}]
await postgrest.select('table').insert(data)
And similarly when querying for data, the returned object would have the column names converted from snake_case to camelCase.
Describe alternatives you've considered
pg-promise, knex.js, and objection.js provide similar utils to help with this issue.
Additional context
Add any other context or screenshots about the feature request here.