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='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';",
"SELECT * FROM table1 WHERE column1='eb5910f1-26e6-bc6f-6fbd-df557096b883';",
"SELECT * FROM table1 WHERE column1='bff9d9d5-ee3d-d852-62f6-0bdbcc5c8305';"
]
Specification
JSON schema
{
"type": "object",
"properties": {
"template": {
"type": "string"
},
"params": {
"type": "object"
}
},
"required": [
"template",
"params"
]
}