docs: changelog entry for new sparkplug decode and encode functions

This commit is contained in:
Kjell Winblad 2023-06-30 10:28:23 +02:00
parent 01ff3d10d6
commit 4d45de2939
1 changed files with 26 additions and 0 deletions

26
changes/ee/feat-11169.md Normal file
View File

@ -0,0 +1,26 @@
Two new built-in functions `sparkplug_decode` and `sparkplug_encode` have been added to the rule engine SQL like language. These functions are used to decode and encode Sparkplug B messages. The functions are used as follows:
Decode a Sparkplug B message:
```sql
select
sparkplug_decode(payload) as decoded
from t
```
Encode a Sparkplug B message:
```sql
select
sparkplug_encode(json_decode(payload)) as encoded
from t
```
One can also specify a Sparkplug B message type by specifying it as the second argument to the `sparkplug_decode` and `sparkplug_encode` functions. The default is `Payload`:
```sql
select
sparkplug_encode(sparkplug_decode(payload, 'Payload'), 'Payload') as encoded
from t
```