Prisma filtering with startsWith over a non string column

Viewed 22

I'm using Prisma ORM and Postgres for my backend. There is a particular query in which, given a string s, I have to look for records that have an id with s as a prefix. Off course Prisma's startsWith operator looks like the thing I want to use. However, my id column is not a string but a number. Which is the best way to achieve this? I would like to avoid writing the raw sql query. Is there a way to apply operators over computed fields? So I can compute a column that corresponds to the cast of the id column to string and apply startsWith over that column. Thanks in advance

0 Answers
Related