javascript - 在 Async Await NodeJS 中包含 const 数组
问题描述
我需要在以下数组中使“异步等待”工作,以便可以执行其余代码。
listArray = [1520,1320,1560,5091] //dont move array
}).on("close", async () => {
const codeFormat = await `array[${listArray.map((v) => `'${v}'`).reduce((r,v) => `${r},${v}`)}]`
const first = await app.db.raw(`
SELECT distinct t.code
from table AS t
where not exists (select 1 from unnest(${codeFormat}) el where t.code = el)
`)
const second = await app.db.raw(`
select code
from unnest(${codigosFormatadoArquivo}) code
where not exists (select 1 from tableName as t where t.code = code
`)
console.log('first.rows',first.rows)
console.log('second.rows',second.rows)
return resolve({dados, footer, header})
})`
目前的方式,它只是执行第二个“const segundo”查询,第一个不能执行。
解决方案
推荐阅读
- git - 单个代码库但每个客户的样式模板 (scss) 不同
- python - 如何在某些列值上按行过滤多个 csv 文件
- google-cloud-platform - 云作曲家任务无故失败或记录
- java - 添加 Spark 函数时 Eclipse 未检测到 Java main() 函数
- r - 使用为绘图创建的函数时 facet_grid() 出错
- javascript - 使用替换关键字(ASP.NET/JS/JavaScript)在 DropdownList 中搜索选择项
- ocaml - 如何在 utop 的多行命令中移动光标?
- javascript - 如何使用nodejs更新for循环内数组中的单个键值?
- reactjs - 如何获得 2 个与父组件相同的子组件状态?
- dialogflow-es - 交易 API 在移动 Google 帮助中不起作用