diff -Nru erlang-goldrush-0.1.7/debian/changelog erlang-goldrush-0.1.8/debian/changelog --- erlang-goldrush-0.1.7/debian/changelog 2016-03-12 06:41:40.000000000 +0000 +++ erlang-goldrush-0.1.8/debian/changelog 2016-03-18 01:32:47.000000000 +0000 @@ -1,8 +1,14 @@ -erlang-goldrush (0.1.7-2~14.04.0) trusty; urgency=medium +erlang-goldrush (0.1.8-1~14.04.0) trusty; urgency=medium * backport to trusty - -- Richard Hansen Sun, 06 Mar 2016 05:57:44 -0500 + -- Richard Hansen Thu, 17 Mar 2016 21:32:08 -0400 + +erlang-goldrush (0.1.8-1) unstable; urgency=medium + + * Imported Upstream version 0.1.8 + + -- Philipp Huebner Fri, 04 Dec 2015 09:11:08 +0100 erlang-goldrush (0.1.7-2) unstable; urgency=medium diff -Nru erlang-goldrush-0.1.7/.gitignore erlang-goldrush-0.1.8/.gitignore --- erlang-goldrush-0.1.7/.gitignore 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -.eunit -*.beam -.rebar -*.plt -ebin -doc -*.swp -erl_crash.dump -.project -log diff -Nru erlang-goldrush-0.1.7/README.org erlang-goldrush-0.1.8/README.org --- erlang-goldrush-0.1.7/README.org 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/README.org 2015-11-16 20:21:50.000000000 +0000 @@ -51,6 +51,11 @@ glc:eq(a, 0). #+END_EXAMPLE +Select all events where 'a' exists and is not equal to 0. +#+BEGIN_EXAMPLE + glc:neq(a, 0). +#+END_EXAMPLE + Select all events where 'a' exists and is less than 0. #+BEGIN_EXAMPLE glc:lt(a, 0). @@ -220,6 +225,8 @@ #+END_EXAMPLE * CHANGELOG +0.1.8 +- Add support for not equal 0.1.7 - Support multiple functions specified using `with/2` diff -Nru erlang-goldrush-0.1.7/src/glc_code.erl erlang-goldrush-0.1.8/src/glc_code.erl --- erlang-goldrush-0.1.7/src/glc_code.erl 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/src/glc_code.erl 2015-11-16 20:21:50.000000000 +0000 @@ -253,10 +253,11 @@ _OnMatch=fun(#state{}=State2) -> OnMatch(State2) end, State); abstract_filter_({Key, Op, Value}, OnMatch, OnNomatch, State) - when Op =:= '>'; Op =:= '='; Op =:= '<'; + when Op =:= '>'; Op =:= '='; Op =:= '!='; Op =:= '<'; Op =:= '>='; Op =:= '=<'; Op =:= '<=' -> Op2 = case Op of '=' -> '=:='; + '!=' -> '=/='; '<=' -> '=<'; Op -> Op end, diff -Nru erlang-goldrush-0.1.7/src/glc.erl erlang-goldrush-0.1.8/src/glc.erl --- erlang-goldrush-0.1.7/src/glc.erl 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/src/glc.erl 2015-11-16 20:21:50.000000000 +0000 @@ -28,6 +28,8 @@ %% glc:gt(a, 0). %% %% Select all events where 'a' exists and is equal to 0. %% glc:eq(a, 0). +%% %% Select all events where 'a' exists and is not equal to 0. +%% glc:neq(a, 0). %% %% Select all events where 'a' exists and is less than 0. %% glc:lt(a, 0). %% %% Select all events where 'a' exists and is anything. @@ -74,7 +76,7 @@ -export([ lt/2, lte/2, - eq/2, + eq/2, neq/2, gt/2, gte/2, wc/1, nf/1 @@ -113,6 +115,10 @@ eq(Key, Term) -> glc_ops:eq(Key, Term). +-spec neq(atom(), term()) -> glc_ops:op(). +neq(Key, Term) -> + glc_ops:neq(Key, Term). + -spec gt(atom(), term()) -> glc_ops:op(). gt(Key, Term) -> glc_ops:gt(Key, Term). @@ -434,13 +440,23 @@ fun() -> %% If a selection condition but no body is specified the event %% counts as input to the query, but not as filtered out. - {compiled, Mod} = setup_query(testmod7, glc:eq('$n', 'noexists@nohost')), + {compiled, Mod} = setup_query(testmod7a, glc:eq('$n', 'noexists@nohost')), glc:handle(Mod, gre:make([{'$n', 'noexists@nohost'}], [list])), ?assertEqual(1, Mod:info(input)), ?assertEqual(0, Mod:info(filter)), ?assertEqual(1, Mod:info(output)) end }, + {"opfilter not equal test", + fun() -> + {compiled, Mod} = setup_query(testmod7b, glc:neq('$n', 'noexists@nohost')), + glc:handle(Mod, gre:make([{'$n', 'noexists@nohost'}], [list])), + glc:handle(Mod, gre:make([{'$n', 'notexists@nohost'}], [list])), + ?assertEqual(2, Mod:info(input)), + ?assertEqual(1, Mod:info(filter)), + ?assertEqual(1, Mod:info(output)) + end + }, {"opfilter wildcard test", fun() -> {compiled, Mod} = setup_query(testmod8, glc:wc(a)), diff -Nru erlang-goldrush-0.1.7/src/glc_lib.erl erlang-goldrush-0.1.8/src/glc_lib.erl --- erlang-goldrush-0.1.7/src/glc_lib.erl 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/src/glc_lib.erl 2015-11-16 20:21:50.000000000 +0000 @@ -65,6 +65,11 @@ {true, Term2} -> Term2 =:= Term; false -> false end; +matches({Key, '!=', Term}, Event) -> + case gre:find(Key, Event) of + {true, Term2} -> Term2 =/= Term; + false -> false + end; matches({Key, '>', Term}, Event) -> case gre:find(Key, Event) of {true, Term2} -> Term2 > Term; @@ -253,6 +258,8 @@ true; is_valid({Field, '=', _Term}) when is_atom(Field) -> true; +is_valid({Field, '!=', _Term}) when is_atom(Field) -> + true; is_valid({Field, '>=', _Term}) when is_atom(Field) -> true; is_valid({Field, '>', _Term}) when is_atom(Field) -> diff -Nru erlang-goldrush-0.1.7/src/glc_ops.erl erlang-goldrush-0.1.8/src/glc_ops.erl --- erlang-goldrush-0.1.7/src/glc_ops.erl 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/src/glc_ops.erl 2015-11-16 20:21:50.000000000 +0000 @@ -3,7 +3,7 @@ -export([ lt/2, lte/2, - eq/2, + eq/2, neq/2, gt/2, gte/2, wc/1, nf/1 @@ -23,6 +23,7 @@ -type op() :: {atom(), '=<', term()} | {atom(), '=', term()} | + {atom(), '!=', term()} | {atom(), '>', term()} | {atom(), '>=', term()} | {atom(), '*'} | @@ -55,6 +56,14 @@ eq(Key, Term) -> erlang:error(badarg, [Key, Term]). +%% @doc Test that a field value is not equal to a term. +-spec neq(atom(), term()) -> op(). +neq(Key, Term) when is_atom(Key) -> + {Key, '!=', Term}; +neq(Key, Term) -> + erlang:error(badarg, [Key, Term]). + + %% @doc Test that a field value is greater than a term. -spec gt(atom(), term()) -> op(). gt(Key, Term) when is_atom(Key) -> diff -Nru erlang-goldrush-0.1.7/src/goldrush.app.src erlang-goldrush-0.1.8/src/goldrush.app.src --- erlang-goldrush-0.1.7/src/goldrush.app.src 2015-05-30 18:36:27.000000000 +0000 +++ erlang-goldrush-0.1.8/src/goldrush.app.src 2015-11-16 20:21:50.000000000 +0000 @@ -1,6 +1,6 @@ {application, goldrush, [ {description, "Erlang event stream processor"}, - {vsn, "0.1.7"}, + {vsn, "0.1.8"}, {registered, []}, {applications, [kernel, stdlib, syntax_tools, compiler]}, {mod, {gr_app, []}},