Включить const Array в Asyn c Await NodeJS - PullRequest
0 голосов
/ 02 марта 2020

Мне нужно, чтобы "asyn c await" работал в следующем массиве, чтобы можно было выполнить остальную часть кода.

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 ", первый не может быть выполнен.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...