IrenejMarc / dpq

Simple but powerful PostgreSQL library inspired by higher-level languages.
MIT License
21 stars 9 forks source link

Turn off camelCase to underscore_pg #19

Open ghost opened 7 years ago

ghost commented 7 years ago

For sake of consistency across my front end, back end and all other, I noticed that the camel case to underscore is causing a bit of extra work. (I also use a nodejs script that sends pg data strait to the browser)

Is there an easy way to switch this off without adding relations to each field?

IrenejMarc commented 7 years ago

Not right now, no. You can do this by adding @attr to every field in your types.

Implementing it shouldn't be a big issue though, since it would just require patching attributeName in dpq/attributes.d file. I'll try to find some time for it, but no promises since I've been really busy lately.

ghost commented 7 years ago

I understand completely. Wondering if you'd be open to a pull request for this feature. I'd like it to be set top level somewhere, like when the DB is connected to. Not sure if that's possible because I haven't looked that deep, but I were to would that be okay with you? Wouldn't seem messy or anything?

IrenejMarc commented 7 years ago

Definitely open to a pull request for this, but I'd prefer a compile-time solution, like the current underscoring. Thanks!