MCPcopy Index your code
hub / github.com/questdb/questdb / executeLoop

Method executeLoop

compat/src/test/nodejs-postgres/runner.js:241–259  ·  view source on GitHub ↗
(loopDef, variables, sql)

Source from the content-addressed store, hash-verified

239 }
240
241 async executeLoop(loopDef, variables, sql) {
242 const loopVarName = loopDef.as;
243 const loopVariables = {...variables};
244
245 let iterable;
246 if (loopDef.over !== undefined) {
247 iterable = loopDef.over;
248 } else if (loopDef.range !== undefined) {
249 const {start, end} = loopDef.range;
250 iterable = Array.from({length: end - start + 1}, (_, i) => start + i);
251 } else {
252 throw new Error("Loop must have 'over' or 'range' defined.");
253 }
254
255 for (const item of iterable) {
256 loopVariables[loopVarName] = item;
257 await this.executeSteps(loopDef.steps, loopVariables, sql);
258 }
259 }
260
261 async executeStep(step, variables, sql) {
262 const queryTemplate = step.query;

Callers 1

executeStepsMethod · 0.95

Calls 2

executeStepsMethod · 0.95
fromMethod · 0.65

Tested by

no test coverage detected