I am using Prisma with Postgres. I need to use $q...
# orm-help
m
I am using Prisma with Postgres. I need to use $queryRaw due to use of unsupported tsvector types. In this query, I also need to use an 'in' statement where the items in the 'in' list need to be parameterised.. I have tried this
const ids = [41, 55]
`const result = await prisma.$queryRaw`select * from users where id in (${ids})`;` but I get a kernel panic
PANIC in /root/.cargo/git/checkouts/rust-postgres-dc0fca9be721a90f/8a61d46/postgres-types/src/lib.rs:762:18
expected array type
any Idea how I can achieve this?
my bad, it was in the docs the whole time
import { PrismaClient, Prisma } from '@prisma/client';
const ids = [1, 3, 5, 10, 20];
`const result = await prisma.$queryRaw`SELECT * FROM User WHERE id IN (${Prisma.join(`
ids
`)})`;`
💯 1
the trick was that @prisma/client exports 2 things, the PrismaClient with my generated stuff and Prisma, with the helpers