set
A set model represents a unordered bag of unique elements.
Example:
Query:
e.data(m.set(m.int8()))
Result:
{
"set": {
"int8": {}
}
}
Notes:
A set model composed of unique int8 values
Example:
Query:
e.data(d.set(d.int8(4), d.int8(4)))
Result:
[
4
]
Notes:
A set content based on the model definition above
list
A list model represents the set of list values of a certain submodel.
Example:
Query:
e.data(m.list(m.int8()))
Result:
{
"list": {
"int8": {}
}
}
Notes:
A list model with int8 values
Example:
Query:
e.data(d.list(d.int8(1), d.int8(2), d.int8(3)))
Result:
[
1,
2,
3
]
Notes:
A list content based on the model definition above
map
A map model represents the set of map values of a certain submodel. Keys are always strings.
Example:
Query:
e.data(m.map(m.struct({- foo: m.int8(),
- bar: m.int8(),
})))
Result:
{
"map": {
"struct": {
"bar": {
"int8": {}
},
"foo": {
"int8": {}
}
}
}
}
Notes:
A map model with a string value
Example:
Query:
e.data(d.map({- foo: d.int8(1),
- bar: d.int8(4),
}))
Result:
{
"bar": 4,
"foo": 1
}
Notes:
A map content based on the model definition above
struct
A struct model represents the set of struct values of a fixed length with a corresponding model at each key.
Example:
Query:
e.data(m.struct({- myInt: m.int8(),
- myFloat: m.float(),
}))
Result:
{
"struct": {
"myFloat": {
"float": {}
},
"myInt": {
"int8": {}
}
}
}
Notes:
A struct model composed of the keys "myInt" and "myFloat"
Example:
Query:
e.data(d.struct({- myInt: d.int8(-127),
- myFloat: d.float(-0.00099999),
}))
Result:
{
"myFloat": -0.00099999,
"myInt": -127
}
Notes:
A struct content based on the model definition above
union
A union model represents the set of (discriminated) union values that take one of a fixed number of cases and corresponding model.
Example:
Query:
e.data(m.union({- foo: m.int8(),
- bar: m.string(),
}))
Result:
{
"union": {
"bar": {
"string": {}
},
"foo": {
"int8": {}
}
}
}
Notes:
A union model composed of two cases, where the case "variantA" is of type string and "variantB" of type int8
Example:
Query:
e.data(d.union("foo", d.int8(-127)))
Result:
{
"foo": -127
}
Notes:
A union content based on the model definition above
tuple
A tuple model represents the set of tuple values of a fixed length with a corresponding model at each index.
Example:
Query:
e.data(m.tuple(m.string(), m.int8()))
Result:
{
"tuple": [
{
"string": {}
},
{
"int8": {}
}
]
}
Notes:
A tuple model composed of two values, where the first is of type int32 and the second of type string
Example:
Query:
e.data(d.tuple(d.string("foo"), d.int8(127)))
Result:
[
"foo",
127
]
Notes:
A tuple content based on the model definition above