Iterate over and print all fields and values using TICK script string templating (TICK Scripts)

This snippet uses the string template's range function to iterate over either .Fields or .Tags printing both key and value

Similar To

Details

  • Language: TICK Scripts

Snippet

# Fields
var s = '{{ range $k, $v := .Fields}} {{$k}}={{$}} | {{end}}'

# Tags
var t = '{{ range $k, $v := .Tags}} {{$k}}={{$}} | {{end}}'