sql-typechecker 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/cli.js CHANGED
@@ -243330,10 +243330,13 @@ CREATE FUNCTION ${f.name.name}(${argsForCreateFunction}) RETURNS ${f.multipleRow
243330
243330
  $$${f.code}$$ LANGUAGE ${f.language};
243331
243331
  `;
243332
243332
  const funcInvocation = `${f.name.name}(${f.inputs.map((inp, i) => "$" + (i + 1) + "::" + showTypeDroppingNullable(inp.type))})${asExpression}`;
243333
- const deserializationAndReturn = f.returns.kind === "void" ? "" : `
243334
- const rows = res.rows.map(row => ${genDeserialization(f.returns, "row")});
243335
- return rows${f.multipleRows ? "" : "[0]"};
243336
- `;
243333
+ const deserializationAndReturn = f.returns.kind === "void" ? "" : f.multipleRows === true ? `return res.rows.map(row => ${genDeserialization(f.returns, "row")});` : `
243334
+ const row = res.rows[0];
243335
+ if (row.some(f => f !== null)){
243336
+ return ${genDeserialization(f.returns, "row")}
243337
+ } else {
243338
+ return undefined;
243339
+ }`;
243337
243340
  return `
243338
243341
  export async function ${f.name.name}(pool: Pool, args: ${argsType})
243339
243342
  : Promise<${returnTypeAsString}>{