No commit activity in last 3 years
No release in over 3 years
Add json fields to sequel, even if not supported by the engine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 0
~> 10.0

Runtime

>= 0
 Project Readme

Sequel::Plugins::JsonColumns

This plugin allows using json type columns in sequel, even in mysql where the database doesn't support them.

Usage

Add the plugin to all models in the following way:

class Sequel::Model
  plugin :json_columns
end

Then flag individual columns as containing json data with the json_column class method.

class User < Sequel::Model
  json_column :metadata

  # ...
end

The content of these columns will be automatically parsed as json, so you can access the data as a hash, array etc

user = User.first
user.metadata # => {:name => 'dave', :age => 22}
user.metadata[:age] += 1
user.save_changess

Installation

Add this line to your application's Gemfile:

gem 'sequel-json_columns'

Or install it yourself as:

$ gem install sequel-json_columns

License

The gem is available as open source under the terms of the MIT License.