sqorn/sqorn

Automatically camelcases existing `node-pg`

tuckerconnelly opened this issue · 2 comments

The global monkeypatch in sqorn-pg makes this unusable for us :( we want to slowly migrate to this from node-pg, with our normal snake_case, but the forced camelCase is holding us back.

Making that configurable is on the list of Todos for version 1 (see Projects). You'll probably specify an option when initializing the connection. Initialization will likely be modified to something like this:

const sqorn = require('sqorn-pg')
const pg = require('pg')

const pool = new pg.Pool()
const sq = sqorn({ pg, pool, convertCase: false })

I ended up removing the monkey patch in favor of row transformations.

Sqorn v.0.0.38, lets you configure key transformations with mapInputKeys and mapOutputKeys. These transformations only affect queries executed through their query builder instance.