Can we use case when in prisma query ?
# orm-help
d
Can we use case when in prisma query ?
n
Hey Dhananjay 👋, Welcome to Prisma's Slack Unfortunately, Prisma doesn’t support
when
clauses yet. You would need to create a where clause before passing it in query. Something like this
Copy code
if(title) {
    where = {
      title: { contains: 'prisma' }
    }
  }

  if(description) {
    where ={
      description: { contains: 'prisma' }
    }
  }

const result = await prisma.post.findMany(where)
If that's what you need, can you open a Feature Request explaining your use case?
d
I'll need to return true if the value is not null and false if the value is null