CoursePark / KnexNest

A wrapper for Knex.js that can output list of objects hydrated from a select
76 stars 10 forks source link

Columns name with underscore #11

Open siberiadev opened 4 years ago

siberiadev commented 4 years ago

Hey there! Thanks for awesome lib. I got stuck with project where all DB column names have underscores. for exp:

value_type
created_at

So, when I use knexnest it make me fill very bad. Check below:

knex.select([
    'u.value_type as _value_type'
])....

This query return me an object like:

{
    value: {
        type: 'someType'
    }
}

but I need

{
    value_type: 'someType'
}

How can I fix it? Any recommendation? Thanks a lot.

imduchy commented 4 years ago

Would it work to do something like

knex.select([
    'u.value_type as _valueType'
])....

or do you specifically need value_type?

johnykifle commented 3 years ago

Any update on this one? @Duchynko that would require changing all the db schema to camel case format.