feat: add new sql-funcs random/0 and uuid_v4/0
This commit is contained in:
parent
74006440a8
commit
2929e986ef
|
@ -3,7 +3,7 @@
|
|||
{vsn, "4.4.19"}, % strict semver, bump manually!
|
||||
{modules, []},
|
||||
{registered, [emqx_rule_engine_sup, emqx_rule_registry, emqx_rule_engine_jwt_sup]},
|
||||
{applications, [kernel,stdlib,rulesql,getopt,jose]},
|
||||
{applications, [kernel,stdlib,rulesql,getopt,jose,uuid]},
|
||||
{mod, {emqx_rule_engine_app, []}},
|
||||
{env, []},
|
||||
{licenses, ["Apache-2.0"]},
|
||||
|
|
|
@ -216,6 +216,12 @@
|
|||
, mongo_date/2
|
||||
]).
|
||||
|
||||
%% Random Funcs
|
||||
-export([ random/0
|
||||
, uuid_v4/0
|
||||
, uuid_v4_nodash/0
|
||||
]).
|
||||
|
||||
%% Proc Dict Func
|
||||
-export([ proc_dict_get/1
|
||||
, proc_dict_put/2
|
||||
|
@ -887,6 +893,18 @@ term_encode(Term) ->
|
|||
term_decode(Data) when is_binary(Data) ->
|
||||
erlang:binary_to_term(Data).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% Random Funcs
|
||||
%%------------------------------------------------------------------------------
|
||||
random() ->
|
||||
rand:uniform().
|
||||
|
||||
uuid_v4() ->
|
||||
uuid_str(uuid:get_v4(), binary_standard).
|
||||
|
||||
uuid_v4_nodash() ->
|
||||
uuid_str(uuid:get_v4(), binary_nodash).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% Dict Funcs
|
||||
%%------------------------------------------------------------------------------
|
||||
|
@ -1039,3 +1057,6 @@ function_literal(Fun, [FArg | Args]) when is_atom(Fun), is_list(Args) ->
|
|||
end, WithFirstArg, Args) ++ ")";
|
||||
function_literal(Fun, Args) ->
|
||||
{invalid_func, {Fun, Args}}.
|
||||
|
||||
uuid_str(UUID, DisplyOpt) ->
|
||||
uuid:uuid_to_string(UUID, DisplyOpt).
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
, {mysql, {git, "https://github.com/emqx/mysql-otp", {tag, "1.7.2"}}}
|
||||
, {epgsql, {git, "https://github.com/emqx/epgsql.git", {tag, "4.6.0"}}}
|
||||
, {grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.7"}}}
|
||||
, {uuid, {git, "https://github.com/okeuday/uuid.git", {tag, "v2.0.6"}}}
|
||||
]}.
|
||||
|
||||
{xref_ignores,
|
||||
|
|
Loading…
Reference in New Issue