DT
Join ServerDrizzle Team
help
Help with raw query
The following query is all raw. Is there a way to make SQL raw only the part of the
where
clause? (or still better a way to not use raw sql at all)await dbConn.execute<User>(
sql`select * from ${UserModel} where similarity("name", ${q}) > ${treshold}`
);
Yes, you can
also if "name" is a column in UserModel you can do this(I would suggest to do this)
await db.select().from(UserModel).where(sql`similarity("name", ${q}) > ${treshold}`)
also if "name" is a column in UserModel you can do this(I would suggest to do this)
await db.select().from(UserModel).where(sql`similarity(${UserModel.name}, ${q}) > ${treshold}`)