Current section
4 Versions
Jump to
Current section
4 Versions
Compare versions
8
files changed
+56
additions
-15
deletions
| @@ -51,6 +51,11 @@ Select all events where 'a' exists and is equal to 0. | |
| 51 51 | glc:eq(a, 0). |
| 52 52 | #+END_EXAMPLE |
| 53 53 | |
| 54 | + Select all events where 'a' exists and is not equal to 0. |
| 55 | + #+BEGIN_EXAMPLE |
| 56 | + glc:neq(a, 0). |
| 57 | + #+END_EXAMPLE |
| 58 | + |
| 54 59 | Select all events where 'a' exists and is less than 0. |
| 55 60 | #+BEGIN_EXAMPLE |
| 56 61 | glc:lt(a, 0). |
| @@ -220,6 +225,8 @@ or | |
| 220 225 | #+END_EXAMPLE |
| 221 226 | |
| 222 227 | * CHANGELOG |
| 228 | + 0.1.8 |
| 229 | + - Add support for not equal |
| 223 230 | |
| 224 231 | 0.1.7 |
| 225 232 | - Support multiple functions specified using `with/2` |
| @@ -1,18 +1,18 @@ | |
| 1 1 | {<<"name">>,<<"goldrush">>}. |
| 2 | - {<<"version">>,<<"0.1.7">>}. |
| 2 | + {<<"version">>,<<"0.1.8">>}. |
| 3 | + {<<"requirements">>,#{}}. |
| 3 4 | {<<"app">>,<<"goldrush">>}. |
| 5 | + {<<"maintainers">>,[<<"Pedram Nimreezi">>,<<"Loic Hoguin">>]}. |
| 4 6 | {<<"precompiled">>,false}. |
| 5 7 | {<<"description">>,<<"Erlang event stream processor">>}. |
| 6 8 | {<<"files">>, |
| 7 | - [{<<"src/goldrush.app.src">>, |
| 8 | - <<"{application,goldrush,\n [{description,\"Erlang event stream processor\"},\n {vsn,\"0.1.7\"},\n {registered,[]},\n {applications,[kernel,stdlib,syntax_tools,compiler]},\n {mod,{gr_app,[]}},\n {env,[]},\n {maintainers,[\"Pedram Nimreezi\",\"Loic Hoguin\"]},\n {licenses,[\"ISC\"]},\n {links,[{\"GitHub\",\"https://github.com/DeadZen/goldrush\"}]}]}.\n">>}, |
| 9 | - <<"src/glc.erl">>,<<"src/glc_code.erl">>,<<"src/glc_lib.erl">>, |
| 10 | - <<"src/glc_ops.erl">>,<<"src/gr_app.erl">>,<<"src/gr_context.erl">>, |
| 11 | - <<"src/gr_counter.erl">>,<<"src/gr_counter_sup.erl">>, |
| 12 | - <<"src/gr_manager.erl">>,<<"src/gr_manager_sup.erl">>, |
| 13 | - <<"src/gr_param.erl">>,<<"src/gr_param_sup.erl">>,<<"src/gr_sup.erl">>, |
| 14 | - <<"src/gre.erl">>,<<"priv/edoc.css">>,<<"rebar.config">>,<<"README.org">>, |
| 15 | - <<"LICENSE">>]}. |
| 9 | + [<<"src/goldrush.app.src">>,<<"LICENSE">>,<<"README.org">>, |
| 10 | + <<"priv/edoc.css">>,<<"rebar.config">>,<<"rebar.lock">>,<<"src/glc.erl">>, |
| 11 | + <<"src/glc_code.erl">>,<<"src/glc_lib.erl">>,<<"src/glc_ops.erl">>, |
| 12 | + <<"src/gr_app.erl">>,<<"src/gr_context.erl">>,<<"src/gr_counter.erl">>, |
| 13 | + <<"src/gr_counter_sup.erl">>,<<"src/gr_manager.erl">>, |
| 14 | + <<"src/gr_manager_sup.erl">>,<<"src/gr_param.erl">>, |
| 15 | + <<"src/gr_param_sup.erl">>,<<"src/gr_sup.erl">>,<<"src/gre.erl">>]}. |
| 16 16 | {<<"licenses">>,[<<"ISC">>]}. |
| 17 17 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/DeadZen/goldrush">>}]}. |
| 18 18 | {<<"build_tools">>,[<<"rebar3">>]}. |
| @@ -0,0 +1 @@ | |
| 1 | + []. |
| @@ -28,6 +28,8 @@ | |
| 28 28 | %% glc:gt(a, 0). |
| 29 29 | %% %% Select all events where 'a' exists and is equal to 0. |
| 30 30 | %% glc:eq(a, 0). |
| 31 | + %% %% Select all events where 'a' exists and is not equal to 0. |
| 32 | + %% glc:neq(a, 0). |
| 31 33 | %% %% Select all events where 'a' exists and is less than 0. |
| 32 34 | %% glc:lt(a, 0). |
| 33 35 | %% %% Select all events where 'a' exists and is anything. |
| @@ -74,7 +76,7 @@ | |
| 74 76 | |
| 75 77 | -export([ |
| 76 78 | lt/2, lte/2, |
| 77 | - eq/2, |
| 79 | + eq/2, neq/2, |
| 78 80 | gt/2, gte/2, |
| 79 81 | wc/1, |
| 80 82 | nf/1 |
| @@ -113,6 +115,10 @@ lte(Key, Term) -> | |
| 113 115 | eq(Key, Term) -> |
| 114 116 | glc_ops:eq(Key, Term). |
| 115 117 | |
| 118 | + -spec neq(atom(), term()) -> glc_ops:op(). |
| 119 | + neq(Key, Term) -> |
| 120 | + glc_ops:neq(Key, Term). |
| 121 | + |
| 116 122 | -spec gt(atom(), term()) -> glc_ops:op(). |
| 117 123 | gt(Key, Term) -> |
| 118 124 | glc_ops:gt(Key, Term). |
| @@ -434,13 +440,23 @@ events_test_() -> | |
| 434 440 | fun() -> |
| 435 441 | %% If a selection condition but no body is specified the event |
| 436 442 | %% counts as input to the query, but not as filtered out. |
| 437 | - {compiled, Mod} = setup_query(testmod7, glc:eq('$n', 'noexists@nohost')), |
| 443 | + {compiled, Mod} = setup_query(testmod7a, glc:eq('$n', 'noexists@nohost')), |
| 438 444 | glc:handle(Mod, gre:make([{'$n', 'noexists@nohost'}], [list])), |
| 439 445 | ?assertEqual(1, Mod:info(input)), |
| 440 446 | ?assertEqual(0, Mod:info(filter)), |
| 441 447 | ?assertEqual(1, Mod:info(output)) |
| 442 448 | end |
| 443 449 | }, |
| 450 | + {"opfilter not equal test", |
| 451 | + fun() -> |
| 452 | + {compiled, Mod} = setup_query(testmod7b, glc:neq('$n', 'noexists@nohost')), |
| 453 | + glc:handle(Mod, gre:make([{'$n', 'noexists@nohost'}], [list])), |
| 454 | + glc:handle(Mod, gre:make([{'$n', 'notexists@nohost'}], [list])), |
| 455 | + ?assertEqual(2, Mod:info(input)), |
| 456 | + ?assertEqual(1, Mod:info(filter)), |
| 457 | + ?assertEqual(1, Mod:info(output)) |
| 458 | + end |
| 459 | + }, |
| 444 460 | {"opfilter wildcard test", |
| 445 461 | fun() -> |
| 446 462 | {compiled, Mod} = setup_query(testmod8, glc:wc(a)), |
| @@ -253,10 +253,11 @@ abstract_filter_({Key, '!'}, OnMatch, OnNomatch, State) -> | |
| 253 253 | _OnMatch=fun(#state{}=State2) -> OnMatch(State2) end, |
| 254 254 | State); |
| 255 255 | abstract_filter_({Key, Op, Value}, OnMatch, OnNomatch, State) |
| 256 | - when Op =:= '>'; Op =:= '='; Op =:= '<'; |
| 256 | + when Op =:= '>'; Op =:= '='; Op =:= '!='; Op =:= '<'; |
| 257 257 | Op =:= '>='; Op =:= '=<'; Op =:= '<=' -> |
| 258 258 | Op2 = case Op of |
| 259 259 | '=' -> '=:='; |
| 260 | + '!=' -> '=/='; |
| 260 261 | '<=' -> '=<'; |
| 261 262 | Op -> Op |
| 262 263 | end, |
Loading more files…