Transforming rules in JSON format
When is this useful?
If you want to use the same transforming rules for js and SQL set
.
Usage
var set = set//returns corresponding sql `set` clauseset//returns js function
SQL set
set// returns `id` = 1, name = 'Apple'set// returns `created` = now()set// returns `rating` = rating + 1
Transform function
var fruit = name: 'Apple' rating: 1setfruit// fruit will be// {name: 'Apple', rating: 2}setfruit// fruit will be// {name: 'Apple', rating: 1, created: '2015-11-09 14:45:00'}setfruit// fruit will be// {name: 'Apple', rating: 3}