Drizzle search column for string

Very noob question: Hey, I've switched to Drizzle, set up my tables. I've also looked into the filters and operations, but I cannot find any way to search a column for values containing x, e.g. for a search field of usernames. How can I do this in Drizzle? Any answer is greatly appreciated.
6 Replies
Myrseth
Myrseth•12mo ago
Equivilent in Prisma would be, but what about Drizzle? 😅
const query = "john";
const users = await prisma.users.findMany({
where: {
name: { contains: query },
},
});
const query = "john";
const users = await prisma.users.findMany({
where: {
name: { contains: query },
},
});
Myrseth
Myrseth•12mo ago
Thank you, however I want something that acts more like the contains-feature in Prisma, is this possible? I have a value in my db which is "Equinor ASA", if I type "Equinor" with the like-operator, nothing is returned. Same with "Equinor AS". It seems like the value has to equal what you're looking for?
Neto
Neto•12mo ago
you have to wrap using %
Neto
Neto•12mo ago
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
Myrseth
Myrseth•12mo ago
Thank you!