Skip to main content

Fork

key

Commentary

added in 0.1.0

Dynamically creates new instances of this generator.

If key is a supplied with an array, runs a generator for each element. If key is supplied with another generator, the generated value is used. If that value is null, no more forks will be spawned.

Only one instance of a generator will run at a time for each fork key. The fork key for each generator can be accessed through the var forkKey.


Examples

Choosing fork keys

{
"table": "sensors",
"fork": {
"key": {
"_gen": "sequentialString",
"expr": "sensor-~d"
}
},
"row": {
"id": {
"_gen": "var",
"var": "forkKey"
}
}
}

Specification

JSON schema

{
"type": [
"array",
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
}