Map Functions

Map Functions

setKey

available since: 1.0.0

Takes a map value and sets the given key name to the specified value. Returns the resulting map value.

struct {}map
  • V
  • T

Example:

Query:
e.setKey({
  • name: "d",
  • value: d.int8(4),
  • in: e.data(d.map({
    • a: d.int8(1),
    • b: d.int8(2),
    • c: d.int8(3),
    }
    )
    )
    ,
}
)
Result:
{ "a": 1, "b": 2, "c": 3, "d": 4 }

key

available since: 1.0.0

Takes a map value and a key name. Returns the key's value or null.

struct {}

Example:

Query:
e.key(d.string("a"), e.data(d.map({
  • a: d.int8(1),
  • b: d.int8(2),
  • c: d.int8(3),
}
)
)
)
Result:
1

mapMap

available since: 1.0.0

Takes a list value and builds a new one of equal size by passing each value through a mapping expression.

struct {
  • expression :expressionTS
  • value :mapS
}
listS

Example:

Query:
e.mapMap(e.data(d.map({
  • a: d.int8(1),
  • b: d.int8(2),
  • c: d.int8(3),
}
)
)
, f.function(["_key_0","_value_0"], e.addInt8({
  • scope: "_value_0",
}
, d.int8(1)
)
)
)
Result:
{ "a": 2, "b": 3, "c": 4 }