Postgresql – cast uuid to varchar in postgres when I use sequelize


I have a table with a column named _id of which the type is uuid. I cast the type of _id from uuid to varchar, in order to select the records as follows:

SELECT "_id" FROM "records" WHERE "_id"::"varchar" LIKE '%1010%';

and it works well.

(1 row)

I use sequelize as ORM for operation postgres. how to build the query condition in sequelize?

Best Solution

I write the query condition as follows, and it works well. Is there any better solution?

{where: ['_id::"varchar" like ?', '%1010%']},