style: code format fix

This commit is contained in:
JimMoen 2021-10-08 09:46:47 +08:00
parent 585c4892ce
commit 19456d84a5
5 changed files with 14 additions and 14 deletions

View File

@ -408,7 +408,7 @@ cast(Msg) -> gen_server:cast(?CM, Msg).
init([]) ->
TabOpts = [public, {write_concurrency, true}],
ok = emqx_tables:new(?CHAN_TAB, [bag, {read_concurrency, true}|TabOpts]),
ok = emqx_tables:new(?CHAN_TAB, [bag, {read_concurrency, true} | TabOpts]),
ok = emqx_tables:new(?CHAN_CONN_TAB, [bag | TabOpts]),
ok = emqx_tables:new(?CHAN_INFO_TAB, [set, compressed | TabOpts]),
ok = emqx_stats:update_interval(chan_stats, fun ?MODULE:stats_fun/0),

View File

@ -108,7 +108,7 @@ clients_insta(get, #{ bindings := #{name := Name0,
{?MODULE, format_channel_info}) of
[ClientInfo] ->
{200, ClientInfo};
[ClientInfo|_More] ->
[ClientInfo | _More] ->
?LOG(warning, "More than one client info was returned on ~s",
[ClientId]),
{200, ClientInfo};
@ -261,7 +261,7 @@ fuzzy_filter_fun(Fuzzy) ->
run_fuzzy_filter(_, []) ->
true;
run_fuzzy_filter(E = {_, #{clientinfo := ClientInfo}, _}, [{Key, _, RE}|Fuzzy]) ->
run_fuzzy_filter(E = {_, #{clientinfo := ClientInfo}, _}, [{Key, _, RE} | Fuzzy]) ->
Val = case maps:get(Key, ClientInfo, "") of
undefined -> "";
V -> V
@ -319,12 +319,12 @@ eval(Ls) ->
eval(Ls, #{}).
eval([], AccMap) ->
AccMap;
eval([{K, Vx}|More], AccMap) ->
eval([{K, Vx} | More], AccMap) ->
case valuex_get(K, Vx) of
undefined -> eval(More, AccMap#{K => null});
Value -> eval(More, AccMap#{K => Value})
end;
eval([{K, Vx, Default}|More], AccMap) ->
eval([{K, Vx, Default} | More], AccMap) ->
case valuex_get(K, Vx) of
undefined -> eval(More, AccMap#{K => Default});
Value -> eval(More, AccMap#{K => Value})
@ -363,7 +363,7 @@ metadata(APIs) ->
metadata(APIs, []).
metadata([], APIAcc) ->
lists:reverse(APIAcc);
metadata([{Path, Fun}|More], APIAcc) ->
metadata([{Path, Fun} | More], APIAcc) ->
Methods = [get, post, put, delete, patch],
Mds = lists:foldl(fun(M, Acc) ->
try

View File

@ -67,18 +67,18 @@ paginate(Tables, MatchSpec, Params, RowFun) ->
data => [RowFun(Row) || Row <- Rows]}.
query_handle(Table) when is_atom(Table) ->
qlc:q([R|| R <- ets:table(Table)]);
qlc:q([R || R <- ets:table(Table)]);
query_handle([Table]) when is_atom(Table) ->
qlc:q([R|| R <- ets:table(Table)]);
qlc:q([R || R <- ets:table(Table)]);
query_handle(Tables) ->
qlc:append([qlc:q([E || E <- ets:table(T)]) || T <- Tables]).
query_handle(Table, MatchSpec) when is_atom(Table) ->
Options = {traverse, {select, MatchSpec}},
qlc:q([R|| R <- ets:table(Table, Options)]);
qlc:q([R || R <- ets:table(Table, Options)]);
query_handle([Table], MatchSpec) when is_atom(Table) ->
Options = {traverse, {select, MatchSpec}},
qlc:q([R|| R <- ets:table(Table, Options)]);
qlc:q([R || R <- ets:table(Table, Options)]);
query_handle(Tables, MatchSpec) ->
Options = {traverse, {select, MatchSpec}},
qlc:append([qlc:q([E || E <- ets:table(T, Options)]) || T <- Tables]).
@ -140,7 +140,7 @@ do_node_query( Node, Tab, Qs, QueryFun, Continuation
end;
{cutrows, NMeta} ->
{SubStart, NeedNowNum} = rows_sub_params(Len, NMeta),
ThisRows = lists:sublist(Rows, SubStart, NeedNowNum),
ThisRows = lists:sublist(Rows, SubStart, NeedNowNum),
NResults = lists:sublist( lists:append(Results, ThisRows)
, SubStart, Limit),
case NContinuation of

View File

@ -502,7 +502,7 @@ unsubscribe(#{clientid := ClientID, topic := Topic}) ->
end.
subscribe_batch(#{clientid := ClientID, topics := Topics}) ->
ArgList = [[ClientID, Topic, Qos]|| #{topic := Topic, qos := Qos} <- Topics],
ArgList = [[ClientID, Topic, Qos] || #{topic := Topic, qos := Qos} <- Topics],
emqx_mgmt_util:batch_operation(?MODULE, do_subscribe, ArgList).
%%--------------------------------------------------------------------
@ -628,7 +628,7 @@ fuzzy_filter_fun(Fuzzy) ->
run_fuzzy_filter(_, []) ->
true;
run_fuzzy_filter(E = {_, #{clientinfo := ClientInfo}, _}, [{Key, _, RE}|Fuzzy]) ->
run_fuzzy_filter(E = {_, #{clientinfo := ClientInfo}, _}, [{Key, _, RE} | Fuzzy]) ->
Val = case maps:get(Key, ClientInfo, "") of
undefined -> "";
V -> V

View File

@ -165,7 +165,7 @@ fuzzy_filter_fun(Fuzzy) ->
run_fuzzy_filter(_, []) ->
true;
run_fuzzy_filter(E = {{_, Topic}, _}, [{topic, match, TopicFilter}|Fuzzy]) ->
run_fuzzy_filter(E = {{_, Topic}, _}, [{topic, match, TopicFilter} | Fuzzy]) ->
emqx_topic:match(Topic, TopicFilter) andalso run_fuzzy_filter(E, Fuzzy).
%%--------------------------------------------------------------------