chore: make static_checks happy

This commit is contained in:
JianBo He 2023-03-17 11:34:12 +08:00
parent c0a216a740
commit 75c1592e7c
2 changed files with 8 additions and 10 deletions

View File

@ -25,7 +25,7 @@
desc/1
]).
-define(DEFAULT_SQL, <<
-define(DEFAULT_CQL, <<
"insert into mqtt_msg(topic, msgid, sender, qos, payload, arrived, retain) "
"values (${topic}, ${id}, ${clientid}, ${qos}, ${payload}, ${timestamp}, ${flags.retain})"
>>).
@ -55,7 +55,7 @@ values(post, Type) ->
pool_size => 8,
username => <<"root">>,
password => <<"public">>,
sql => ?DEFAULT_SQL,
sql => ?DEFAULT_CQL,
local_topic => <<"local/topic/#">>,
resource_opts => #{
worker_pool_size => 8,
@ -83,7 +83,7 @@ fields("config") ->
{sql,
mk(
binary(),
#{desc => ?DESC("sql_template"), default => ?DEFAULT_SQL, format => <<"sql">>}
#{desc => ?DESC("sql_template"), default => ?DEFAULT_CQL, format => <<"sql">>}
)},
{local_topic,
mk(

View File

@ -172,7 +172,7 @@ on_stop(InstId, #{poolname := PoolName}) ->
emqx_resource:resource_id(),
request(),
state()
) -> emqx_resource:query_result().
) -> ok | {ok, ecql:cql_result()} | {error, {recoverable_error | unrecoverable_error, term()}}.
on_query(
InstId,
Request,
@ -397,12 +397,10 @@ assign_type_for_params([], Acc) ->
assign_type_for_params([Param | More], Acc) ->
assign_type_for_params(More, [may_assign_type(Param) | Acc]).
may_assign_type(V) when is_boolean(V) ->
{int,
if
V -> 1;
true -> 0
end};
may_assign_type(true) ->
{int, 1};
may_assign_type(false) ->
{int, 0};
may_assign_type(V) when is_binary(V); is_list(V); is_atom(V) -> V;
may_assign_type(V) when is_integer(V) ->
%% The max value of signed int(4) is 2147483647