hiddentao/squel

Export/import query as object/JSON

Opened this issue · 3 comments

Hi,

is it possible to do something like this (pseudo):
var myRawQuery = squel.select().from('MY_TABLE').fields(['ONE', 'TWO']); var myJSONQuery = myRawQuery.toJSON();

That would be a great option to "re-use" existing queries.

toJSON() isn't currently supported, but you can clone() queries -> https://hiddentao.com/squel/#cloning

Thanks for the input but the goal is to re-imported a composed query at a later point in time to go on composing it.

With clone() I don't see a way of achieving this?

Hmm, yeah I see your point. A toJSON() would be good. Will add a possible feature for the next release. PR welcome.