fix(rules): dialyer failed to analysis the emqx_rule_sqlparser:parse/1
This commit is contained in:
parent
0d26e50e87
commit
e630e23846
|
@ -62,6 +62,12 @@ delete_rule(RuleId) ->
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Internal Functions
|
%% Internal Functions
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%% The pattern {'ok', Select} can never match the type {'error',{_,[{_,_,_,_}]}}.
|
||||||
|
%% probably due to stack depth, or inlines.
|
||||||
|
-dialyzer({nowarn_function, [do_create_rule/1, parse_outputs/1, do_parse_outputs/1,
|
||||||
|
pre_process_repub_args/1, preproc_vars/1]}).
|
||||||
|
|
||||||
do_create_rule(Params = #{id := RuleId, sql := Sql, outputs := Outputs}) ->
|
do_create_rule(Params = #{id := RuleId, sql := Sql, outputs := Outputs}) ->
|
||||||
case emqx_rule_sqlparser:parse(Sql) of
|
case emqx_rule_sqlparser:parse(Sql) of
|
||||||
{ok, Select} ->
|
{ok, Select} ->
|
||||||
|
|
|
@ -237,6 +237,10 @@ param_path_id() ->
|
||||||
%% Rules API
|
%% Rules API
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%% The pattern {'ok', Rule} can never match the type {'error',{_,'invalid_string' | binary() | [tuple()] | {_,[any()]} | {_,'sql_lex',{_,_}}}}
|
||||||
|
%% probably due to stack depth, or inlines.
|
||||||
|
-dialyzer({nowarn_function, [crud_rules/2, crud_rules_by_id/2]}).
|
||||||
|
|
||||||
list_events(#{}, _Params) ->
|
list_events(#{}, _Params) ->
|
||||||
{200, emqx_rule_events:event_info()}.
|
{200, emqx_rule_events:event_info()}.
|
||||||
|
|
||||||
|
@ -283,10 +287,7 @@ crud_rules_by_id(put, #{bindings := #{id := Id}, body := Params0}) ->
|
||||||
crud_rules_by_id(delete, #{bindings := #{id := Id}}) ->
|
crud_rules_by_id(delete, #{bindings := #{id := Id}}) ->
|
||||||
case emqx_rule_engine:delete_rule(Id) of
|
case emqx_rule_engine:delete_rule(Id) of
|
||||||
ok -> {200};
|
ok -> {200};
|
||||||
{error, not_found} -> {200};
|
{error, not_found} -> {200}
|
||||||
{error, Reason} ->
|
|
||||||
?LOG(error, "delete rule failed: ~0p", [Reason]),
|
|
||||||
{500, #{code => 'UNKNOW_ERROR', message => err_msg(Reason)}}
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -74,7 +74,7 @@ parse(Sql) ->
|
||||||
from = get_value(from, Clauses),
|
from = get_value(from, Clauses),
|
||||||
where = get_value(where, Clauses)
|
where = get_value(where, Clauses)
|
||||||
}};
|
}};
|
||||||
{error, Error} -> {error, Error}
|
Error -> {error, Error}
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
_Error:Reason:StackTrace ->
|
_Error:Reason:StackTrace ->
|
||||||
|
|
Loading…
Reference in New Issue