Skip to content

Introduce hooks to transform incoming resultsets & outgoing payloads

gwn requested to merge gwn/massive-js:data-transformers into master

Most likely use case is the transformation of field name casings, e.g. from / to snake and camel.

I found out that this has been requested several times before and I think allowing it would add value to Massive.

I've been enjoying a similar feature from Postgres.js a lot:

Before proposing this, I considered the use of pg-promise's receive hook; but realized that things might get a little complicated when joins are involved. Also it's not helpful for inserts / updates.

Not sure if such a feature is your cup of tea or if you'd approve of the implementation; but I'll be using this in my projects and wanted to share it here maybe at least to get some feedback if I'm lucky.

Merge request reports