Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bookshelf/case-converter-plugin
Bookshelf plugin for handling the conversion between the database's snake_cased and a model's camelCased properties automatically.
https://github.com/bookshelf/case-converter-plugin
bookshelf bookshelf-plugin bookshelfjs javascript plugin
Last synced: about 1 month ago
JSON representation
Bookshelf plugin for handling the conversion between the database's snake_cased and a model's camelCased properties automatically.
- Host: GitHub
- URL: https://github.com/bookshelf/case-converter-plugin
- Owner: bookshelf
- License: mit
- Created: 2019-08-04T15:43:43.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-24T10:50:46.000Z (over 2 years ago)
- Last Synced: 2024-07-19T18:24:08.241Z (about 2 months ago)
- Topics: bookshelf, bookshelf-plugin, bookshelfjs, javascript, plugin
- Language: JavaScript
- Size: 1000 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Bookshelf Case Converter Plugin
[![Build Status](https://travis-ci.com/bookshelf/case-converter-plugin.svg?branch=master)](https://travis-ci.com/bookshelf/case-converter-plugin) [![Greenkeeper badge](https://badges.greenkeeper.io/bookshelf/case-converter-plugin.svg)](https://greenkeeper.io/)
This is a plugin for the [Bookshelf Node.js ORM](https://bookshelfjs.org/) 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:- [model.query()](https://bookshelfjs.org/api.html#Model-instance-query)
- [model.where()](https://bookshelfjs.org/api.html#Model-instance-where)
- [collection.query()](https://bookshelfjs.org/api.html#Collection-instance-query)
- [collection.where()](https://bookshelfjs.org/api.html#Collection-instance-where)