docs: changelog entry for new sparkplug decode and encode functions
This commit is contained in:
parent
01ff3d10d6
commit
4d45de2939
|
@ -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
|
||||||
|
```
|
Loading…
Reference in New Issue