Andrew Valleteau
11/03/2021, 7:58 PMprisma.$queryRaw<boolan>("SELECT my_function($1, $2, $3, $4)", param_1, param_2, param_3, Prisma.join(myArrayOfString));
However, this doesn't work. What is the proper way to convert my array of string into his {"value1","value2"}
equivalent ?Julien Goux
11/05/2021, 2:43 PMTasin Ishmam
11/08/2021, 7:12 AMqueryRaw,
correct?
I would recommend using the array[...]
notation insetad of {...}
notation for this. So for the query you mentioned, try:
prisma.$queryRaw<boolan>`SELECT my_function(${param_1}, ${param_2}, ${param_3}, array[${Prisma.join(myArrayOfString)}])`
Tasin Ishmam
11/08/2021, 7:15 AMarray_append
function which just adds an element to the end of an array.
let array_of_strings = [ "bar", "temp"];
let foo = "foo"
console.log(
await prisma.$queryRaw<any>`SELECT array_append(ARRAY[${Prisma.join(array_of_strings)}], ${foo})`,
); // prints [ { array_append: [ 'bar', 'temp', 'foo' ] } ]