I am using EMQX Kuiper. https://docs.emqx.io/en/kuiper/latest/rules/overview.html#sinks-actions
Where in my rule settings, I am using dataTemplate
property to fetch my data. Where I have to use Go template. No way to write go script only template.
Using this template I able to print first item of my slice.
"dataTemplate": "{{json (index . 0)}}"
But I need to print last item of my slice. Can't print this. Tried to achieve that with the Go template language like this,
"dataTemplate": "{{$lenMyList := len .}} {{json (index . $lenMyList -1)}}"
But to no avail.