mekanika / qe

Query envelope (Qe) specification
2 stars 0 forks source link

Towards Qe #4

Closed cayuu closed 9 years ago

cayuu commented 9 years ago

0.5.0 has renamed Qo to Qe (Query envelopes) ahead of the last major change that is coming in 0.6.0: shifting over to a significantly ordered list, rather than an object hash.

This includes a move back to concise structure for {$field,$op,$value} structures (ie. all 'field-objects'). As a structured envelope, Qe fit closer to ømq style approaches, and there remains a trivial mapping between the old Qo and the envelope style Qe.

Significant structure means Qe actually read quite well:

// Create a new user "zim"
['create','users',,,[{name:'zim'}]] // -> id: 123
// Update age on user 123
['update','users',['123'],,[{power:5}]]
// Find all posts with > 50 comments
['find','posts',,{and:[{comments:{gt:50}}]}]

Of course, writing these by hand may be problematic. However in this case, Qe generator libraries like query may allow for writing Qe via fluent API or in "plain old" object format, to be converted for OTW transmission in pure Qe format.

cayuu commented 9 years ago

Landed a87e7e542bf230