Skip to content

Add fieldNameMap to allow camelcase results. #1962

@andrewitsover

Description

@andrewitsover

Postgres only has lowercase column names unless you put everything in quotes. node-postgres returns an array of objects. These objects will therefore all have lowercase property names despite the convention in javascript for camelcase.

Mapping the returned array to a new array is a waste of resources. I think it would be a good idea to have a configuration option for the driver so that you can input a map, such as:

{ 'userid': 'userId', 'refreshtoken': 'refreshToken' }

Which would then be used in result.js to make a new fields array:

var field = this.fields[i].name

to allow the returned objects to respect the naming convention of the programming language instead of the database and prevent bugs.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions