In rego, I want to convert this:
d := {"a": "aye", "B": "bEe"}
to:
l := {"a": "aye", "b": "bEe"}
where the keys are all lowercased, but the values are not. How can this be done in one assignment line, or more if needed. I’d expect one of the following to work, but they don’t, nor do any of the myriad of permutations I have tried similarly.
d := {"a": "aye", "B": "bEe"}
l1 := { k: lower(v) | k = d[_]; v = d[k] }
l2 := { k: lower(v) | k = d[_], v = d[k] }
l3 := { k : lower(v) |
k = d[_]
v = d[k]
}
In python this could be:
l = {k.lower(): v for k, v in d.items()}
How can the same be accomplished in rego?