From 20cf06c917722c26e186c013ab904bc988aa5ee1 Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Wed, 21 Jun 2023 16:35:28 +0800 Subject: [PATCH] chore: add changelogs for random sql functions --- apps/emqx_rule_engine/src/emqx_rule_funcs.erl | 4 ++-- changes/v4.4.19-en.md | 6 ++++++ changes/v4.4.19-zh.md | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/emqx_rule_engine/src/emqx_rule_funcs.erl b/apps/emqx_rule_engine/src/emqx_rule_funcs.erl index b71adef44..0531af225 100644 --- a/apps/emqx_rule_engine/src/emqx_rule_funcs.erl +++ b/apps/emqx_rule_engine/src/emqx_rule_funcs.erl @@ -219,7 +219,7 @@ %% Random Funcs -export([ random/0 , uuid_v4/0 - , uuid_v4_nodash/0 + , uuid_v4_no_hyphen/0 ]). %% Proc Dict Func @@ -902,7 +902,7 @@ random() -> uuid_v4() -> uuid_str(uuid:get_v4(), binary_standard). -uuid_v4_nodash() -> +uuid_v4_no_hyphen() -> uuid_str(uuid:get_v4(), binary_nodash). %%------------------------------------------------------------------------------ diff --git a/changes/v4.4.19-en.md b/changes/v4.4.19-en.md index a71da1a3a..62c52fb5a 100644 --- a/changes/v4.4.19-en.md +++ b/changes/v4.4.19-en.md @@ -33,6 +33,12 @@ Previously, this interface had a `connections` field, which represented the number of active connections on the current node that had not expired. This means that even if the MQTT connection has been disconnected, as long as the client has a persistent session, it would still be counted in the `connections` field. The newly added `live_connections` field specifically counts the number of clients with MQTT connections that have not been disconnected. +- Added 3 random SQL functions to the rule engine [#11113](https://github.com/emqx/emqx/pull/11113). + + - random(): Generates a random number between 0 and 1 (0.0 =< X < 1.0). + - uuid_v4(): Generates a random UUID (version 4) string. + - uuid_v4_no_hyphen(): Generates a random UUID (version 4) string without hyphens. + ## Bug fixes - Fixed an issue where the rule engine was unable to access variables exported by `FOREACH` in the `DO` clause [#10620](https://github.com/emqx/emqx/pull/10620). diff --git a/changes/v4.4.19-zh.md b/changes/v4.4.19-zh.md index e07915749..0f6e1da7b 100644 --- a/changes/v4.4.19-zh.md +++ b/changes/v4.4.19-zh.md @@ -33,6 +33,12 @@ 此前该接口中有一个 `connections` 字段,它代表当前节点上会话未过期的连接数量。这意味着即使 MQTT 连接已经断开,只要客户端保持了会话,它仍然会被统计在 `connections` 中。新增的 `live_connections` 字段则仅仅统计 MQTT 连接未断开的客户端数量。 +- 规则引擎新增了三个随机函数 [#11113](https://github.com/emqx/emqx/pull/11113)。 + + - random():生成 0 到 1 之间的随机数 (0.0 =< X < 1.0)。 + - uuid_v4():生成随机的 UUID (version4) 字符串。 + - uuid_v4_no_hyphen():生成随机的不带连词符的 UUID (version4) 字符串。 + ## 修复 - 修复规则引擎无法在 `DO` 子句中访问 `FOREACH` 导出的变量的问题 [#10620](https://github.com/emqx/emqx/pull/10620)。