bookshelf-case-converter-plugin
v2.0.0
Published
A plugin for Bookshelf that converts between the database's snake_cased and a model's camelCased properties automatically.
Downloads
676
Readme
Bookshelf Case Converter Plugin
This is a plugin for the Bookshelf Node.js ORM that handles the conversion between the database's snake_cased and a model's camelCased properties automatically.
How to use
First install the package:
npm install bookshelf-case-converter-plugin
Then load the plugin using bookshelf.plugin('bookshelf-case-converter-plugin')
. No further action is required, since
the plugin will automatically convert model attributes between snake_case and camelCase.
Limitations
Note that there are some limitations to the way this plugin works. When you access query methods directly, there will be no conversion, meaning that you have to use the actual database column names in this case. The following methods do no work with this plugin yet: