fix(emqx_rule_engine): Dialyzer warnings
This commit is contained in:
parent
692f59afaf
commit
8bb8dc5363
|
@ -154,6 +154,7 @@ module_attributes(Module) ->
|
||||||
%% APIs for rules and resources
|
%% APIs for rules and resources
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-dialyzer([{nowarn_function, create_rule/1}]).
|
||||||
-spec(create_rule(#{}) -> {ok, rule()} | no_return()).
|
-spec(create_rule(#{}) -> {ok, rule()} | no_return()).
|
||||||
create_rule(Params = #{rawsql := Sql, actions := Actions}) ->
|
create_rule(Params = #{rawsql := Sql, actions := Actions}) ->
|
||||||
case emqx_rule_sqlparser:parse_select(Sql) of
|
case emqx_rule_sqlparser:parse_select(Sql) of
|
||||||
|
@ -178,7 +179,7 @@ create_rule(Params = #{rawsql := Sql, actions := Actions}) ->
|
||||||
Error -> error(Error)
|
Error -> error(Error)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec(update_rule(#{}) -> {ok, rule()} | no_return()).
|
-spec(update_rule(#{id := binary(), _=>_}) -> {ok, rule()} | no_return()).
|
||||||
update_rule(Params = #{id := RuleId}) ->
|
update_rule(Params = #{id := RuleId}) ->
|
||||||
case emqx_rule_registry:get_rule(RuleId) of
|
case emqx_rule_registry:get_rule(RuleId) of
|
||||||
{ok, Rule0} ->
|
{ok, Rule0} ->
|
||||||
|
@ -364,8 +365,7 @@ with_resource_params(Args = #{<<"$resource">> := ResId}) ->
|
||||||
end;
|
end;
|
||||||
with_resource_params(Args) -> Args.
|
with_resource_params(Args) -> Args.
|
||||||
|
|
||||||
may_update_rule_params(Rule, Params) when map_size(Params) =:= 0 ->
|
-dialyzer([{nowarn_function, may_update_rule_params/2}]).
|
||||||
Rule;
|
|
||||||
may_update_rule_params(Rule, Params = #{rawsql := SQL}) ->
|
may_update_rule_params(Rule, Params = #{rawsql := SQL}) ->
|
||||||
case emqx_rule_sqlparser:parse_select(SQL) of
|
case emqx_rule_sqlparser:parse_select(SQL) of
|
||||||
{ok, Select} ->
|
{ok, Select} ->
|
||||||
|
|
Loading…
Reference in New Issue