Bookshelf Json Columns

Parse JSON columns with Bookshelf.js
Alternatives To Bookshelf Json Columns
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Kotlinx.serialization4,53311210 hours ago15August 18, 2022343apache-2.0Kotlin
Kotlin multiplatform / multi-format serialization
Jsontokotlinclass2,750
6 months ago2August 13, 202234gpl-3.0Kotlin
🚀 Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )
Dprint1,92512a day ago89June 29, 202252mitRust
Pluggable and configurable code formatting platform written in Rust.
Kunpeng1,454
a year ago21apache-2.0Go
kunpeng是一个Golang编写的开源POC框架/库,以动态链接库的形式提供各种语言调用,通过此项目可快速开发漏洞检测类的系统。
Bludit1,111
a month ago50mitJavaScript
Simple, Fast, Secure, Flat-File CMS
Wal2json1,055
4 months ago1March 03, 202121bsd-3-clauseC
JSON output plugin for changeset extraction
Mobility89030103 days ago87June 24, 202234mitRuby
Pluggable Ruby translation framework
Json Viewer636
22 days ago17mitC++
A JSON viewer plugin for Notepad++. Displays the selected JSON string in a tree view.
Flexijsoneditor534
4 years ago5May 21, 201818otherJavaScript
JSON editor jQuery plugin
Sublimetext_indentxml519
5 years ago26mitPython
Plugin for Sublime Text editor for reindenting XML and JSON files
Alternatives To Bookshelf Json Columns
Select To Compare


Alternative Project Comparisons
Readme

bookshelf-json-columns

This Bookshelf.js plugin enables you to define which model columns have JSON format, preventing manual hook definition for each model with JSON columns.

Status

npm version node version build status coverage status

Installation

Install the package via npm:

$ npm install --save bookshelf-json-columns

Usage

Require and register the bookshelf-json-columns plugin:

var bookshelf = require('bookshelf')(knex);
var jsonColumns = require('bookshelf-json-columns');

bookshelf.plugin(jsonColumns);

Define which columns have JSON format with the jsonColumns class property:

bookshelf.Model.extend({
  tableName: 'foo'
}, {
  jsonColumns: ['bar', 'biz']
});

If you're using ES6 class syntax, define jsonColumns as static property:

class Model extends bookshelf.Model {
  get tableName() {
    return 'foo';
  }

  static jsonColumns = ['bar', 'biz'];
}

This plugin extends the initialize and save methods of Bookshelf's Model, so if you are also extending or overriding them on your models make sure to call their prototype after your work is done:

bookshelf.Model.extend({
  initialize: function() {
    // Do some stuff.
    store.addModel(this);

    // Call the `initialize` prototype method.
    bookshelf.Model.prototype.initialize.apply(this, arguments);
  },
  save: function() {
    // Do some stuff.
    store.validateModel(this);

    // Call the `save` prototype method.
    bookshelf.Model.prototype.save.apply(this, arguments);
  },
  tableName: 'foo'
}, {
  jsonColumns: ['bar', 'biz']
});

Contributing

Contributions are welcome and greatly appreciated, so feel free to fork this repository and submit pull requests.

bookshelf-json-columns supports PostgreSQL, SQLite3 and MySQL. You can find test suites for all these database engines in the test folder.

Setting up

  • Fork and clone the bookshelf-json-columns repository.
  • Duplicate all .dist knexfiles and update them to your needs.
  • Make sure all the tests pass:
$ npm test

Linting

bookshelf-json-columns enforces linting using ESLint with the Seegno-flavored ESLint config. We recommend you to install an eslint plugin in your editor of choice, although you can run the linter anytime with:

$ eslint src test

Pull Request

Please follow these advices to simplify the pull request workflow:

  • If you add or enhance functionality, an update of README.md usage section should be part of the PR.
  • If your PR fixes a bug you should include tests that at least fail before your code changes and pass after.
  • Keep your branch rebased and fix all conflicts before submitting.
  • Make sure Travis build status is ok.

License

MIT

Popular Json Projects
Popular Plugin Projects
Popular Data Formats Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Plugin
Json
Mysql
Postgresql
Sqlite
Linting
Eslint
Knex
Jsonb