Skip to content

Commit

Permalink
allow query of all fields from event type using syntax type(*). see s…
Browse files Browse the repository at this point in the history
  • Loading branch information
dspinoz committed Apr 12, 2017
1 parent ce8322b commit da5cbb5
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 85 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
JS_TESTER = ./node_modules/vows/bin/vows
PEG_COMPILER = ./node_modules/pegjs/bin/pegjs
JS_TESTER = /usr/bin/vows
PEG_COMPILER = /usr/bin/pegjs

.PHONY: test

Expand Down
252 changes: 171 additions & 81 deletions lib/cube/event-expression.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/cube/event-expression.peg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

function noop() {}

function everything(fields) {
delete fields.t;
}

function filter(op) {
return function(o, k, v) {
var f = o[k];
Expand Down Expand Up @@ -90,7 +94,8 @@ event_filter_expression
= op:filter_operator _ "(" _ member:event_member_expression _ "," _ value:literal _ ")" { return function(o) { op(o, member.field, value); }; }

event_value_expression
= type:type _ "(" _ head:event_member_expression tail:(_ "," _ event_member_expression)* _ ")" { return compoundFields(type, head, tail); }
= type:type _ "(" _ "*" _ ")" { return {type: type, exists: noop, fields: everything}; }
/ type:type _ "(" _ head:event_member_expression tail:(_ "," _ event_member_expression)* _ ")" { return compoundFields(type, head, tail); }
/ type:type { return {type: type, exists: noop, fields: noop}; }

event_member_expression
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"mongodb": "^2.2.25",
"node-static": "0.6.5",
"pegjs": "0.7.0",
"pegjs": "0.6.2",
"vows": "0.7.0",
"websocket": "1.0.8",
"node-websocket-server": "1.1.4"
Expand Down

0 comments on commit da5cbb5

Please sign in to comment.