Pascal Sthamer
02/18/2021, 1:33 PMconst queries = []
for (const somevar of somearray) {
const params = await someAsyncFunc(somevar)
queries.push(prisma.someQuery(optsWithParams))
}
await prisma.$transaction(queries)
The thing Im unsure about is that query 1 might be finished before calling prisma.$transaction because there are async operations required to generate the other queries.Ryan
02/18/2021, 1:34 PMRyan
02/18/2021, 1:35 PMPascal Sthamer
02/18/2021, 1:38 PMRyan
02/18/2021, 1:39 PMawait
or call them inside the transaction, they will not fire before that.Pascal Sthamer
02/18/2021, 1:39 PMPascal Sthamer
02/18/2021, 1:39 PMPascal Sthamer
02/18/2021, 1:40 PMRyan
02/18/2021, 1:40 PM