Transformation functions
interpolate
Commentary
added in 1.11.0
Interpolates named tokens in a string. Tokens are denoted with a leading colon (:foo).
This function preparses and caches the templatized string so repeated runs are fast.
Examples
Interpolating tokens
Supply a template string containing tokens with leading colons and a params map of token name to value.
{
"_gen": "interpolate",
"template": "SELECT * FROM table1 WHERE column1=':id';",
"params": {
"id": {
"_gen": "uuid"
}
}
}
[
"SELECT * FROM table1 WHERE column1='ba419d35-0dfe-8af7-aee7-bbe10c45c028';",
"SELECT * FROM table1 WHERE column1='4f083ce3-f12b-bb4b-46ee-9d82b52c856d';",
"SELECT * FROM table1 WHERE column1='aa616abe-1761-0c9a-e743-67bd738597dc';",
"SELECT * FROM table1 WHERE column1='5e688e99-61b3-5c88-4697-6cf7b0bfbe20';",
"SELECT * FROM table1 WHERE column1='76b20010-c318-5754-c86c-400eff88a1e3';"
]
Specification
JSON schema
{
"type": "object",
"properties": {
"template": {
"type": "string"
},
"params": {
"type": "object"
}
},
"required": [
"template",
"params"
]
}